Skip to main content

Social Login

Social Login, a key component of Authentication and Customer Registration, offers users the convenience of bypassing traditional forms. By signing into your website using their existing social media accounts, such as Facebook, Twitter, LinkedIn, Google, and more, users can effortlessly create customer profiles and enjoy seamless login experiences. This feature simplifies the onboarding process and enhances user convenience across various use cases.

Common Use Cases

  • Frictionless Onboarding: This feature simplifies registration by allowing users to sign up or log in with their social media accounts.
  • Seamless Data Collection: Social Login automatically fetches verified user data such as email, name, and profile picture, significantly reducing the need for additional input fields. This not only saves users time and effort but also simplifies the registration process for developers.
  • Improved Engagement Rates: By offering a convenient login method that users are familiar with, Social Login can significantly boost sign-up and engagement rates. This not only enhances the user experience but also increases the reach and impact of your application.

To explore these workflows, visit our Live Demo Page to experience how Social Login can enhance your applications.

Note: LoginRadius provides an Account Linking feature that links customer profiles from different providers. This document explains account linking in more detail.

Configurations

  • Navigate to the Authentication -> Social Providers section in the LoginRadius Admin Console.
  • Ensure you're on the Configuration tab and choose the social providers (e.g., Google, Facebook, Twitter) you want to enable.
  • Use the toggle switch on the right to enable the provider.
  • Click on the provider's icon or name to open the Configuration tab.
  • Go to the Setup Guide tab and follow the instructions to create an app in the provider’s developer portal.
  • Obtain the Consumer Key and Consumer Secret from the developer portal.
  • Return to the Configuration tab and enter the consumer Key and Secret in the input fields.
  • Click Update to save the configuration.

Note: To disable a social provider, simply toggle the switch to the OFF position.

Integration Guide

This section offers a detailed walkthrough for integrating a robust and secure social login process into your application using LoginRadius. It includes back-end integration, front-end customization, LoginRadius SocialLogin Library functions, programmatic links, SDKs and Libraries, and post-login management to deliver a seamless user experience.

Implementing Social Login Using LoginRadius JavaScript Interface

LoginRadius provides a built-in JavaScript interface to render a customizable social login experience.

var custom_interface_option = {};
custom_interface_option.templateName = "loginradiuscustom_tmpl";

LRObject.util.ready(function () {
LRObject.customInterface(".interfacecontainerdiv", custom_interface_option);
});

Add an HTML container where the interface will be rendered:

<div id="interfacecontainerdiv" class="interfacecontainerdiv"></div>

API-Driven Approach

If you obtain a social provider's access token (e.g., from Google, Facebook, etc.) separately, you can exchange it for a LoginRadius access token.

Capture the access token from the provider’s response.

  • Google OAuth: Returns both an ID token and an access token.
  • Facebook SDK: Issues an access token after login.
  • Firebase: Generates an authentication token for the signed-in user

You can create custom links for buttons or trigger social login. To initiate authentication, format your links as follows:

  • Link Format:
https://<Site-Name>.hub.loginradius.com/RequestHandler.aspx?apikey=<LoginRadius API Key>&provider=<Provider Name>

In the above, replace <your LoginRadius Site Name> with your actual LoginRadius site name, <your LoginRadius API Key> with your API key, and <Provider Name> with the lowercase name of the social provider (e.g., Facebook, twitter, etc.).

SDKs and Libraries

LoginRadius offers robust SDKs to simplify Social Login implementation:

  • Web SDK:
    To implement Social login using Web SDK, please refer to this document.
  • Mobile SDK
    To implement Social login using Mobile SDK, please refer to this document.

Post-Login Actions

  1. Session Management:
    • Store the access token securely (e.g., in-session storage).

    • Handle token expiration securely to maintain user sessions.

      To learn more about managing sessions, please refer to this document.

  2. Profile Enrichment:
    • Use the access token to fetch additional user details via LoginRadius Auth APIs.

Best Practices for Social Login Integration

  • Configure accurate Redirect URIs to prevent callback failures.
  • Test changes in a staging or development environment before pushing to production.
  • Secure access tokens using best practices (e.g., secure storage, HTTPS, short lifetimes).