OAuth2 API Overview
Complete guide to OAuth2 social login configuration and authentication types
OAuth2 API
Integrate social login providers with comprehensive OAuth2 authentication system
Overview
The OAuth2 API enables you to configure and manage social login integrations with various providers like Google, Facebook, GitHub, and more. This system handles authentication flows, user information retrieval, and secure token management.
Core Types
OAuth2Registration
type OAuth2Registration {
registrationId: String!
clientId: String
clientSecret: String
clientAuthenticationMethod: String
authorizationGrantType: String
redirectUriTemplate: String
scope: [String]
authorizationUri: String
tokenUri: String
userInfoUri: String
userNameAttributeName: String
jwkSetUri: String
clientName: String
}registrationId - Unique provider identifierclientId - Application client IDclientSecret - Application secret keyclientName - Provider display nameclientAuthenticationMethod - Auth methodauthorizationGrantType - Grant typescope - Permissions requestedauthorizationUri - Authorization endpointtokenUri - Token exchange endpointuserInfoUri - User info endpointjwkSetUri - JSON Web Key Set URIredirectUriTemplate - Callback URL templateuserNameAttributeName - Username fieldSupported Providers
OAuth2 Flow
User clicks social login button and is redirected to provider's authorization page
User grants permissions and approves requested scopes
Provider redirects back with authorization code
Backend exchanges code for access token at token endpoint
Retrieve user profile from provider's user info endpoint
Create or link user account and establish authenticated session
Example Configuration
{
"registrationId": "google",
"clientId": "217015743019-arfgls5skjg3tehl67gf8sitbf0rq9k9.apps.googleusercontent.com",
"clientSecret": "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",
"clientAuthenticationMethod": "BASIC",
"authorizationGrantType": "authorization_code",
"redirectUriTemplate": "{baseUrl}/oauth2/callback/{registrationId}",
"scope": ["openid", "profile", "email", "address", "phone"],
"authorizationUri": "https://accounts.google.com/o/oauth2/v2/auth",
"tokenUri": "https://www.googleapis.com/oauth2/v4/token",
"userInfoUri": "https://www.googleapis.com/oauth2/v3/userinfo",
"userNameAttributeName": "sub",
"jwkSetUri": "https://www.googleapis.com/oauth2/v3/certs",
"clientName": "Google"
}Key Features
Industry-standard OAuth2 protocol with secure token handling
Configure multiple social login providers simultaneously
Automatically retrieve and sync user information from providers
Request specific permissions based on your application needs
Available Endpoints
Initiate OAuth2 authorization flow with provider-specific authorization URL
Configure and manage OAuth2 provider registrations (Admin only)