Web
Connect user sessions to your web app using Anon Link
Getting Started
Anon Link for web uses an OAuth-style linking process to securely link end-user accounts to your application. This guide will walk you through the implementation of this process.
1 - Generate an Anon Link URL
Generate a URL for your end-users to link their accounts:
Replace the following parameters:
Parameter | Description |
---|---|
APP | The app name you’re linking to (e.g., instagram ) |
APP_USER_ID | The ID of the user linking their account (e.g. user-id-123 ) |
REDIRECT_URL | The URL to redirect the user back to after the linking process is complete (e.g. https://your.web.app/link/redirect ) |
YOUR_ANON_API_KEY | Your Anon API key (e.g. anon_randomCombinationOfLetters&Numbers1234567890 ) |
2 - Display Anon Link
When a user wants to link one of their account to your web app, send them to Anon Link using the linkUrl
from the previous step.
For example, the end-user clicks a button in your app that generates the linkUrl
and redirects them to Anon Link.
Here’s the end-to-end flow:
User Initiates Link
The end-user clicks a button in your app that generates the link URL, redirecting them to Anon’s OAuth dialog flow.
User Authorizes
The user confirms authorization for Anon to link their session for the specified app.
User Authenticates
The user enters their credentials directly into the app website’s login flow via popup.
Redirect
Once the user completes authentication, they are redirected to the redirect URL you registered in Step 1 with query parameters describing the link result.
3 - Handle the Redirect
After the session has been saved, the user is redirected back to your web app via the redirect URL. The redirect URL is called with several query parameters describing the result of the link process.
Parameter | Description | Values |
---|---|---|
type | Indicates the result of the linking process | 'success' 'error' |
error_code | Present only when type is 'error' | 'bad_input' 'bad_authorization' 'anon_internal_error' |
state | The same state value provided in the initial request |
A valid redirect URL with a successul link result will look like this:
Handle the redirect in your application by checking the type
parameter to
determine the result of the linking process:
At this point, the user’s session is linked. Your app can now automate actions on their behalf using the stored session.
Next Steps
Run Authenticated Sessions
Learn how to use linked sessions for automation
Supported Integrations
View the list of platforms supported by Anon
If you encounter any issues or have questions, don’t hesitate to reach out to the Anon team at support@anon.com.