OAuth refresh token flow
This guide will help you understand how to set up a standard refresh token flow for an OAuth app. For more details on which flow to use or how to set up your OAuth app within Kit, please refer to the more general “Authentication” guide.
We also offer example OAuth implementations that can be viewed below:
OAuth refresh token flow
User initiates install from Kit's App Store
When a user installs your app from the Kit App Store, Kit redirects them to the Authorization URL
you’ve configured.
From here, your app should present the user a screen to sign in (or sign up).
App requests user's Kit identity
After the user successfully authenticates with your app, redirect them to Kit’s OAuth server to request their identity.
Kit prompts user for consent
Kit will present a consent screen that asks the user to grant or refuse your app access to their account.
Kit redirects to App OAuth callback with authorization code
If the user grants access, Kit redirects the user back to the redirect_uri
you provided when requesting the user’s identity in step 2.
Kit appends a code
query param with a temporary authorization code.
App exchanges authorization code for refresh and access tokens
Your app uses the authorization code provided to obtain a refresh and access token.
With a body like so:
App redirects user back to Kit
Now that the user has completed the OAuth flow, your app must send the the user back to Kit using the redirect
parameter provided at the beginning of the flow.
This will ensure the user properly navigates back to your app inside of Kit and registers that the app has been installed.
Redirect URL after install
field in your app’s settings, a modal prompting creators to continue their journey on your configured site will appear at this point. See this section in the app details page guide for more details.App uses access token to make Kit API calls
Your app can now make calls to Kit’s API on behalf of the user by passing a Authorization
header with the token as a Bearer
value.
App uses refresh token to obtain new access token after expiration
The access token will eventually expire and a new one must be obtained using the refresh token obtained earlier. To do this, make a POST
call to https://app.kit.com/oauth/token
, with the following body: