Authentication and Authorization API
Every user has 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. By default, session token is valid for 2 hours. Any API request prolongs the token validity for another 2 hours.
A session token is an opaque string that identifies a user and an application.
Create session token
As a starting point, the user’s session token needs to be created allowing user any further actions within the app. Pass login/email and password to identify a user:
Endpoint
Parameters
Parameter | Required | Description |
---|---|---|
user[login] | Yes* | User’s login |
user[email] | Yes* | User’s email |
user[password] | Yes | User’s Password |
provider | Optional | Possible values: facebook, twitter, firebase_phone, firebase_email |
keys[token] | Optional | Social network provider’s access token |
keys[secret] | Optional, for Twitter only | Social network provider’s access token secret |
firebase_phone[project_id] | Optional, for Firebase only | Firebase project ID - the unique identifier for your Firebase project |
firebase_phone[access_token] | Optional, for Firebase only | Firebase user’s ID token |
firebase_email[project_id] | Optional, for Firebase only | Firebase project ID - the unique identifier for your Firebase project |
firebase_email[access_token] | Optional, for Firebase only | Firebase user’s ID token |
There are four available sets of data to specify when create a session with a user:
login
andpassword
email
andpassword
provider
+keys[token]
andkeys[secret]
- when sign up with Facebook or Twitterprovider
+firebase_phone[project_id]
andfirebase_phone[access_token]
- when sign up with a phone numberprovider
+firebase_email[project_id]
andfirebase_email[access_token]
- when sign up with a email
Request example
Response
Note: With the request above, the user is created automatically on the fly upon session creation using the login (or email) and password from the request parameters.
Important: For better security it is recommended to deny the session creation without an existing user.
For this, set ‘Session creation without an existing user entity’ to Deny under the Application -> Overview -> Permissions in the admin panel.
Create session with Guest User
Session can be created with temporary guest user, user will be automatically created, session with guest user valid for 1 day after user will be automatically deleted.
NOTE: Guest user can’t be authorized by login/email password
Parameters
Parameter | Required | Description |
---|---|---|
user[guest] | No | Define creating session with temporary guest user |
user[full_name] | No | Set guest user full_name |
Request example
Response
Get information about session
Retriving information about the current (active) session from token specified as a header.
Endpoint
Request example
Response
Destroy session
The request destroys all of the data associated with the current session.