Dub supports OAuth 2.0 authentication, which is recommended if you build integrations extending Dub’s functionality.
This example demonstrates how to authenticate users with Dub OAuth 2.0 flow.
Live demo: https://oauth.dub.sh
Follow the steps below to get started:
- Create a new Integration in your Dub workspace.
- Fill in all the appropriate fields.
- Make sure to set your redirect URIs:
- Local development:
http://localhost:3000/api/oauth/callback
- Production:
https://yourdomain.com/api/oauth/callback
- Local development:
- Copy the
Client ID
andClient Secret
values and paste them into the.env
file asDUB_CLIENT_ID
andDUB_CLIENT_SECRET
respectively. - Install the dependencies and start the app.
- Click the Sign in with Dub button to initiate the OAuth flow.
To learn more about Dub's OAuth flow, take a look at the following resources: