Conscent.ai Developer Documentation
  • Version 2.0
    • Using Conscent.ai
    • Web SDK
    • Login
    • Logout
    • User Details Drawer
    • Google One Tap
    • Mobile SDK
      • iOS(Swift)
        • In-App Purchases with Conscent
      • Android SDK
      • React Native SDK
      • Google In-App Purchases with Conscent
      • Apple In-App Purchases with Conscent
    • Facebook SSO Integration Guide
    • Landing Page API v 2.0
    • AMP Integration
    • Integrating APIs(v2)
      • Purchase Details
      • User Registered Or Not
      • User Registrations
      • Subscription Plans Details
      • Get User Details
      • Add Subscription If User Registered
      • Update UserDetails
      • Update SubscriptionDetails
      • Get All Transaction Details
    • IAM System API Documentation
  • Version 1.0
    • Getting Started
    • On Board
    • Using Conscent.ai
    • Authentication
    • Web SDK
    • Login
    • Logout
    • Amp Documentation
    • Mobile SDK
      • Android
      • Flutter
      • iOS(Swift)
      • React Native SDK
    • Auto Login
    • Creating External Purchases
    • Landing Page API
  • Login Screen Customization
  • Integrating Client Payment Gateway
  • Integrating with APIs
    • User Details and Subscriptions Information
    • Purchased Subscriptions
    • User and Purchase Details
    • Client Purchases
    • Client Micropayments
    • Client Passes
    • Cancel Active Subscriptions
    • Delete User
  • Events API Docs
    • Different Types of Events
    • SSO Login Flow
  • Discount Coupon
    • Dynamic Coupon API Generation:
  • New Webhooks
    • Meter Banner Webhook
    • Paywall Webhook
    • SignUp Webhook
    • Refund Webhook
    • Purchase Webhook
    • Subscription Landing Page Webhook
    • Popup Webhook
    • User Update Webhook
    • Payment Gateway Webhook
    • Review Page Webhook
    • Transaction Webhook
    • Login Webhook
    • Cancel Subscription Webhook
  • Old Webhooks
    • Sign Up Webhook
    • Login Webhook
    • Subscription Payment Webhook
    • Subscription Cancelled Webhook
    • Pass Payment Webhook
    • Subscription Bundle Payment Webhook
    • Review Subscription Webhook
    • Micro Payment Webhook
    • How to validate Webhooks?
  • Registering The Content
    • Create Content
    • Edit Content
    • View Content
  • Country Code List
  • Supported Currencies and Payment Gateways
    • Stripe Supported Country with Currency
    • Razorpay Supported Country with Currency
    • Paypal Supported Country with Currency
  • Errors
  • Loyalty System
    • Web SDK
    • iOS SDK
    • Android SDK
    • Flutter SDK
    • API from server
Powered by GitBook
On this page
  • CONSCENT LOGIN:
  • CLIENT LOGIN:
  • Authorization Code (JWT)
  1. Version 2.0

Login

The ConsCent SSO service allows users to authenticate themselves on the ConsCent platform. This service supports both login and logout functionalities, which can be hosted by either ConsCent or client

CONSCENT LOGIN:

The below code is used for implementing the ConsCent Login System.

User Login

To prompt the user to log in, use the following code:

const csc = window._csc as any;
csc('login-with-redirect',{useSocialLogin:boolean});

Check User Authentication Status

To check whether the user is logged in, use the following code:

const csc = window._csc;
_csc('add-auth-state-listener', (userId) => {
  if (userId) {
    console.log('User is logged in');
  } else {
    console.log('User is not logged in');
  }
});

Fetch User Details

To retrieve the logged-in user's details, use the following code:

const csc = window._csc;
csc('get-user-details', {
  successCallbackForUserDetails: async (userDetailsObject) => {
    console.log('Success callback received from ConsCent login', userDetailsObject);
  },
});

CLIENT LOGIN:

The SSO service utilizes a JWT (JSON Web Token) authorization code, generated upon successful login, to manage user authentication. This guide outlines the necessary steps to integrate the SSO service into your application, including endpoint details and usage examples.

Authorization Code (JWT)

Upon successful authentication, an authorization code in the form of a JWT is generated.

  • Signing Algorithm: RSA256

  • Public Key Requirement: To verify the JWT, share your public key with ConsCent in PEM (Privacy Enhanced Mail) format. The key must be 2048 bits.

AuthorizationCodeToken {
  iss: string; // client group ID 
  sub: string; // user ID
  exp: number; // expiry date unix time
  iat: number; // issue date unix time
  jti: string; // session ID
  unq: string; // unique identifier for each authz_code (uuid v4 preferred)
  email?: string;
  phone?: string;
  name?: string;
}

Login and Logout Endpoint

  • URL: The Login and Logout URLs need to be shared by the client with Conscent Team.

  • Functionality:

For Login: Redirects the user to the specified login page for authentication. Once authenticated, the service generates an authorization code and redirects the user to a URL specified in the redirectUrl query parameter.

For Logout: Redirects the user to the specified logout page, logs them out.The user is then redirected to a URL specified in the redirectUrl query parameter.

  • Required Parameters:

    • redirectUrl: Specifies the URL where the user should be redirected post-login.

    • clientId: Specifies the client’s unique identifier.

Example Requests:

*Login Request*

REDIRECT https://sso.host/login?redirectUrl=https://yourapp.com/home&clientId=client1

*Logout Request*

REDIRECT https://sso.host/logout?redirectUrl=https://yourapp.com/home&logoutFromAllDevices=false&clientId=client1

Example Response:

*After successful authentication, the user is redirected to*

REDIRECT https://yourapp.com/home?authorizationCode=AUTH_CODE

*After successful logout, the user is redirected to*

REDIRECT https://yourapp.com/home
PreviousWeb SDKNextLogout

Last updated 3 months ago