Login

User Login

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

const csc = window._csc as any;
csc('login-with-redirect');

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);
  },
});

Last updated