# Authentication
All Console API requests require a Token which provides access to devices owned by the user which owns the device.
To generate a token Call the Login endpoint with your account email and password. From then on, you will want to include the Token in all of your API requests. You do this by placing your Token in an HTTP header field called "Authorization".
Headers
Header Name | Required | Type | Description |
---|---|---|---|
Authorization | required | string | Bearer {token} (Token generated using Login API) |
Organization | required | string | Organization ID to select the a specific organization account |
Accept | required | string | application/json |
# Login
Get a secure token to access account services via API using your email and password
POST /auth/login
Example request
$ curl https://console.radiobridge.com/api/visualization/v1/auth/login
curl --location 'https://radiobridge.test/api/visualization/v1/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "****",
"password": "****"
}'
# Request Parameters
Property | Description |
---|---|
(required) User account email | |
password | (required) Account password |
Example request body
{
"email": "{your email}",
"password": "{password}"
}
Response Properties
Property | Type | Description |
---|---|---|
organizations | array | Lists all organization a user is part of |
token | string | Authentication token to be used with all requests |
Example response
If a user has enabled the 2FA, then following response will be returned.
To enable Two Factor authentication visit
{
"status": false,
"mfa": true,
"auth_type": "authenticator",
"message": "2 factor authentication has been enabled in your account. Please enter 2FA code."
}
Parameter | type | Description |
---|---|---|
status | boolean | Indicates if login was successful or failed |
mfa | boolean | True, if two factor authentication will be enabled |
auth_type | string | 2FA authentication type. Allowed values: authenticator (Google Authenticator) |
message | string | Human readable error or success message |
Once user enters the Two-Factor Authentication code (depends on auth_type) then send below request to verify 2FA and login.
Example request body
{
"email": "{your email}",
"password": "{password}",
"verify_2fa": "yes",
"console_login": true,
"authentication_code": "123456"
}
Property | Description |
---|---|
(required) User account email | |
password | (required) Account password |
verify_2fa | (required) Yes to verify the entered authentication code, If the user authenticates using recovery code set that to No |
authentication_code | (required) 6-digit code received from the Google Authenticator app |
recovery_code | (required if verify_2fa = no) Send a recovery code in case you are not able to use the authenticator app. |
Example response
{
"organizations": [
{
"id": 1,
"name": "Radio Bridge Inc",
"parent_org_id": null,
"address_line_1": null,
"address_line_2": null,
"logo": null,
"created_at": "2021-12-21T10:32:20.000000Z",
"account": {
"user_id": 1,
"org_id": 1,
"id": 1,
"timezone_format": "Asia/Kolkata",
"timezone_id": 94,
"country_id": 226,
"created_at": "2018-04-11T22:17:07.000000Z",
"updated_at": "2021-11-10T04:14:04.000000Z",
"trial_ends_at": "2022-02-28",
"is_demo_account": 0
}
}
],
"token": "{token}"
}
# Refresh Token
When the login token expires then create a new token using the expired token within a predefined token expiry time window.
GET /auth/refresh-token
Example request
$ curl --location --request GET 'https://console.radiobridge.com/api/visualization/v1/auth/refresh-token' \
--header 'Authorization: Bearer <token>'
Example response
{
"token": "<token>",
"token_type": "bearer",
"expires_in": 2592000
}
# Get User Details
Pull the logged-in user information, permissions for a given organization.
GET /user/get-org-user/me
Example request
$ curl --location --request GET 'https://console.radiobridge.com/api/visualization/v1/user/get-org-user/me' \
--header 'Organization: <organization id>' \
--header 'Authorization: Bearer <token>'
Example response
{
"data": {
"id": 1,
"timezone_format": "Asia/Calcutta",
"timezone_id": 96,
"name": "Deepak Maurya",
"email": "example@radiobridge.com",
"permissions": [
"manage_account",
"manage_widget_dashboard",
"manage_devices",
"manage_gateways",
"manage_groups"
]
}
}
# Logout
Logout the user. This action will invalidate the token so that nobody can use the token for further authentication or create a new token through refresh token endpoint.
GET /logout
Example request
$ curl --location --request GET 'https://console.radiobridge.com/api/visualization/v1/logout' \
--header 'Authorization: Bearer <token>'
Example response
{
"message": "Logged out successfully."
}