Social Login
Redirect URL
This API endpoint handles the redirect URL for social login authentication. It initiates the authentication process and redirects the user to the appropriate social media platform for login.
Query Parameters
- Name
format
- Type
- string
- Description
(Optional) The response format. Accepted values:
json
,redirect
. Default:redirect
. Ifjson
is specified, a JSON response will be returned.
- Name
redirect_url
- Type
- string
- Description
(Optional) The allowed redirect URL to redirect the user after successful authentication. The URL must be added in the AuthC1 dashboard as an allowed redirect URL.
Request
curl https://api.authc1.com/{APPID}/{PROVIDER}/redirect?format=json&redirect_url=https://example.com/auth-callback
Response
{
"url": "https://social-media-provider.com/auth?client_id={CLIENT_ID}&redirect_uri=https://api.authc1.com/{APPID}/{PROVIDER}/callback&scope=email+profile",
}
Callback URL
This API endpoint handles the callback URL after the user has successfully authenticated with the social media platform. It retrieves the user's profile information and completes the authentication process.
Query Parameters
- Name
access_token
- Type
- string
- Description
The access token generated for the authenticated user.
- Name
refresh_token
- Type
- string
- Description
The refresh token associated with the authenticated user's session.
- Name
session_id
- Type
- string
- Description
The session ID for the authenticated user.
- Name
local_id
- Type
- string
- Description
The local ID of the authenticated user.
- Name
email_verified
- Type
- boolean
- Description
Indicates whether the user's email has been verified (true/false).
- Name
expires_at
- Type
- number
- Description
The timestamp at which the authentication session expires.
- Name
expires_in
- Type
- number
- Description
The duration of the authentication session in seconds.
Redirect URL
{callbackUrl}?access_token={accessToken}&refresh_token={refreshToken}&session_id={sessionId}&local_id=${user_id}&email_verified={boolean}&expires_at={timestamp}&expires_in={seconds}
Sign In with Provider Token
This API endpoint allows applications to authenticate users using a provider-specific access token. To use this method, send a POST request to /{APPID}/{PROVIDER}/login
with the following request body:
{
"token": "TOKEN_DATA"
}
Response
Upon successful authentication, this endpoint will return the user's profile information and complete the authentication process.
Response
{
"access_token": "ACCESS_TOKEN",
"refresh_token": "REFRESH_TOKEN",
"session_id": "SESSION_ID",
"local_id": "LOCAL_ID",
"email_verified": true,
"expires_at": 1679817600,
"expires_in": 3600
}
Request
curl -X POST https://api.authc1.com/{APPID}/{PROVIDER}/login -H "Content-Type: application/json" -d '{"token": "TOKEN_DATA"}'
Callback Error Handling
If an error occurs during the social login process, the user will be redirected to the specified redirect_url
(if provided) with an additional error
query parameter. You can handle these errors on your redirect page.
Example Redirect URL with Error:
https://example.com/auth-callback?error=invalid_request&error_description=Invalid+request+parameters.
The following error parameters can be returned:
error
: The error code or error type.error_description
: A human-readable description of the error.
Make sure to handle these errors gracefully and provide appropriate feedback to the user.
Supported Providers
The AuthC1 platform supports the following social media providers for social login:
Please note that the list of supported providers is continuously growing, and new providers may be added in the future.
To enable GitHub as a social login provider in your application, please refer to the documentation for configuring GitHub integration in the AuthC1 dashboard.