SignUp/SignIn with OAuth
In this example, we demonstrate how to use an OAuth provider to sign up and sign in to your app.
✅ Purpose of the scenario:
- The user registers with an OAuth provider (Google, Facebook, etc.)
- Authenticate user with an OAuth provider
- Get authenticated user data after successful OAuth flow
✅ What you need:
- A valid PROJECT_URL and APP_TOKEN for authentication with the OneEntry API.
- OAuth provider configured in the OneEntry admin panel (get its marker via AuthProvider.getAuthProviders()).
- OAuth provider credentials (client_id and client_secret) from Google, Facebook, or another provider.
- Configured redirect_uri matching the one registered with the OAuth provider.
📌 Important:
- These examples do not include error handling.
- You can manage errors using a try-catch block or by employing a construction like await Promise.catch((error) => error).
- The client_secret must NOT be exposed on the client — exchange the code in a Server Action.
- The OAuth flow requires a redirect step first — oauth() needs a real code from the provider.
- Use the OAuth provider marker from your OneEntry admin panel, not the email auth provider marker.
Loading sandbox…
