Building an OAuth 2 App
This guide assumes you've already registered an OAuth 2 app
If not, please refer to OAuth 2 Code Flow to configure your application.
Application basics
Note: you should store your client_id
and (if not using PKCE) client_secret
safely and access them via your environment. The below examples assume the presence of a .env file containing the variables CLIENT_ID
and CLIENT_SECRET
.
Invoking the auth server
First, your application will need to call the Frame.io auth server, which will then redirect the user to a login page.
The callback
The auth server will then make a GET
request to your REDIRECT_URI
, which in turn will need to call the TOKEN_URL
. This callback will be slightly different depending on whether or not your application is configured to use PKCE.
Without PKCE
If you’re not using PKCE, your callback must include an Authorization
header that includes your CLIENT_ID
and CLIENT_SECRET
.
With PKCE
If you’re using PKCE, your callback must not include an Authorization
header, but must include your CLIENT_ID
in its POST
request body when calling back to the TOKEN_URL
.
Successful response
If your callback is successful, you will receive a JSON response that looks like this:
You can now use the access_token
to make API calls to Frame.io on the logged-in user’s behalf, and the refresh_token
to request a new access_token
after this token expires.