Overview
This guide explains how to use Snag’s social integration API to let your users connect their social accounts to their Snag profile. After creating a user in Snag (as explained in Managing User Accounts), you can use the social authentication endpoints to connect various social platforms to that user’s profile.Supported Social Platforms
Snag supports connecting the following social platforms:- Discord
- Telegram
- Epic Games
- Steam
Connecting a Social Account
Endpoint
{authType}
is one of: twitter
, discord
, telegram
, epic
, or steam
or google
.
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
userId | UUID | Yes | The ID of the user received from the user creation endpoint |
websiteId | UUID | No | The ID of the website (if applicable) |
redirect | String | Yes | The URL where the user will be redirected after completing authentication |
responseType | String | No | The type of response to return (redirect or json ). Defaults to redirect |
Example Request
Authentication Flow
- Call the
/api/{authType}/auth
endpoint with the required parameters - The API will return a URL that you should redirect your user to
- The user will authenticate with the social platform and grant permissions
- After successful authentication, the user will be redirected to the URL specified in the
redirect
parameter - The social account is now connected to the user’s Snag profile
Handling Social Account Conflicts
If the social account is already associated with a different user, the redirect URL will include two query parameters:error = 'MAXIMUM_ACCOUNT_LINKED'
- Indicates that the account is already linked to another useraccountLinkData
- A JWT verification token that contains the necessary information to process the account transfer
- Display a confirmation prompt to the user asking if they want to disconnect the account from the other user and link it to their current profile
- If the user confirms, make a POST request to
/api/users/verify
with the following payload:
- Disconnect the social account from the previous user
- Connect it to the current user’s profile
Google OAuth YouTube Channel Errors
When using Google OAuth, if the user’s YouTube channel does not exist, the API will return an error witherror = 'YOUTUBE_CHANNEL_NOT_FOUND'
. This typically happens when:
- The user has never created a YouTube channel
- The YouTube channel was deleted or suspended
- The user’s Google account doesn’t have YouTube access
- Display a user-friendly message explaining that a YouTube channel is required
- Prompt the user to create a YouTube channel first
- Provide instructions on how to create a YouTube channel
- Allow the user to retry the Google OAuth flow after creating their channel
YouTube channels are automatically created when users upload their first video or customize their channel. Users can also manually create a channel by visiting youtube.com and following the setup prompts.
Example Implementation with Conflict Handling
Example Implementation
Response Handling
Success Response (200 OK)
url
property contains the authentication URL that you should redirect your user to.
Custom OAuth Applications
Snag allows you to use your own OAuth applications for Twitter, Discord, Epic Games, Google, and Steam integrations. This enables you to maintain your brand identity throughout the authentication flow and have more control over the user experience. If you would like to use your own client ID and client secret for any of these platforms, please contact the Snag team for integration support. We’ll guide you through the process of setting up and configuring your custom OAuth applications with our system. You will also need to add the following redirect URLs to your OAuth application:https://snag-render.com/api/twitter/auth/callback
https://snag-render.com/api/discord/auth/callback
https://snag-render.com/api/epic/auth/callback
https://snag-render.com/api/steam/auth/callback
https://snag-render.com/api/google/auth/callback