Every user needs to authenticate with ConnectyCube before using any ConnectyCube functionality.
When someone connects with an application using ConnectyCube, the application will need to obtain a session token which provides temporary secure access to ConnectyCube APIs.
A session token is an opaque string that identifies a user and an application.
Session token rights
There are different types of session tokens to support different use cases:
Session Token Type
Description
Application session token
This kind of access token is needed to read the app data. Has only READ access to resources
User session token
The user token is the most commonly used type of token. This kind of access token is needed any time the app calls an API to read, modify or write a specific user’s data on their behalf. Has READ/WRITE access to resources
Session token management
iOS SDK supports automatic session management so you do not need to create a session token on iOS manually:
on your 1st request to API the session token will be created automatically
when the session expires, any further API request will renew it.
Upgrade session token (user login)
If you have an application session, you can upgrade it to a user session by calling logIn method:
Sign In with phone number is supported with Firebase integration.
The whole guide on how to create Firebase project, connect Firebase SDK and implement authentication via phone number is available at our Firebase Setup Guide. Please follow it.
Authentication via external identity provider
Custom Identity Provider (CIdP) feature is necessary if you have your own user database and want to authenticate users in ConnectyCube against it. It works the same way as Facebook/Twitter SSO.
With Custom Identity Provider feature you can continue use your user database instead of storing/copying user data to ConnectyCube database.
CIdP high level integration flow
To get started with CIdP integration, check the Custom Identity Provider guide which describes high level integration flow.
How to login via CIdP
Once you done with the setup mapping in ConnectyCube Dashboard, it’s time to verify the integration.
To perform CIdP login, the same ConnectyCube User Login API is used. You just use existing login request params to pass your external user token:
Once the login is successful, ConnectyCube will create an underalying User entity, so then you can use ConnectyCube APIs in a same way as you do with a normal login. With CIdP we do not have/store any user password in ConnectyCube User entity.
Following further integration, you may need to connect to Chat. In a case of CIdP login, you do not have a user password. In such cases you should use ConnectyCube session token as a password for chat connection. Follow the Connect to Chat with CIdP guide.
Downgrade session token (user logout)
If you have a user session, you can downgrade it to an application session by calling logOut method:
Expiration time for session token is 2 hours after the last request to API is made. But you do not need to worry about it - with the automatic session token management it will be renewed automatically with next request to API (only v1 for now).