Skip to main content

Configure Social Logins

Set up social authentication providers to allow users to sign in with their existing accounts from Google, Microsoft, GitHub, and other popular services.

Overview

Social logins simplify user registration and authentication by leveraging existing accounts from trusted providers. This reduces friction and improves user experience while maintaining security.

Supported Providers

Authsec supports integration with major social identity providers:

  • Google
  • Microsoft
  • GitHub
  • LinkedIn
  • Facebook
  • Twitter
  • Apple

Configuration Steps

1. Enable Social Connections

In your Authsec dashboard:

  1. Navigate to ConnectionsSocial
  2. Select the providers you want to enable
  3. Configure each provider with their credentials

2. Google Configuration

{
"client_id": "your-google-client-id.googleusercontent.com",
"client_secret": "your-google-client-secret",
"allowed_audiences": ["your-google-client-id.googleusercontent.com"],
"scopes": ["openid", "profile", "email"]
}

3. Implementation

// Login with Google
function loginWithGoogle() {
const authUrl = authsec.buildAuthorizeUrl({
response_type: 'code',
scope: 'openid profile email',
connection: 'google-oauth2'
});

window.location.href = authUrl;
}

// Login with Microsoft
function loginWithMicrosoft() {
const authUrl = authsec.buildAuthorizeUrl({
response_type: 'code',
scope: 'openid profile email',
connection: 'windowslive'
});

window.location.href = authUrl;
}

Best Practices

Security

  • Verify social provider certificates
  • Validate returned user information
  • Handle account linking properly
  • Monitor for suspicious activity

User Experience

  • Display clear provider options
  • Handle authentication errors gracefully
  • Provide account linking capabilities
  • Respect user privacy preferences