Create OAuth2 Connection
Create connections folder
Locate the your app folder in the apps directory and add a new connections
folder if it doesn't exist already.
Create connection file
Create a new file within your app's connection folder. For an oauth2 connection, call it your-new-app.oauth2.ts
, replacing your-new-app
with your app id (which should match your app file).
Add your own values. We provided mock data to help initialize the process.
-
export const yourNewAppOAuth2
replacingyourNewApp
with your app name. -
Add an id:
your-new-app_connection_oauth2
- Make sure the id follows the format
<app-id>_connection_oauth2
- Make sure the id follows the format
-
Add the authorize url.
This is a url that will be sent to the client to redirect the user to start the auth flow. For example,
https://accounts.google.com/o/oauth2/v2/auth
-
Add the tokenUrl.
This is used by the server to retrieve access tokens, refresh tokens, and to refresh the tokens. For example,
https://oauth2.googleapis.com/token
-
Add the client id and client secret.
You will need to create an account on the third party platform and follow their instructions to generate these values.
Once you have the values, you will need to add them as environment variables.
To keep the client secret and client id secrets consistent accross the platform, prefix the variable name with
INTEGRATION_
every time. -
Add the required scopes to perform the api calls needed for actions and triggers.
If you ever need to update these scopes, all connections created with the old scopes will still work, but not have the new scopes. We currently don't have a way to refresh old connections with new scopes. So try to make sure you have all scopes you need and think will be needed in the near future.
For example, don't just get the read
scope, get the write
scope as well. Because even if you only plan on adding a read action, it is very likely someone will want to add the write action in the future.
This being said, don't add all the scopes. This is usually a good discussion you can start so that multiple people can determine what scopes are most likely to be needed for the app.
You can always create multiple oauth2 connections with different levels of access. Though we don't really have a good UX for that and could lead to confusion.