Authentication
Organization API uses OAuth authentication protocol in order to grant access and authenticate client requests. Your launch engineer has to provide you with an OAuth client identifier (clientId) and secret (clientSecret) on your request.
The Organization API employs the OAuth authentication protocol to securely authorize and authenticate client requests. To get started, you should request an OAuth client identifier (commonly known as clientId) and a secret key (clientSecret) from your Launch Support Engineer. These credentials are essential for establishing a secure connection with the API. Remember, the clientId serves as your unique identifier, while the clientSecret acts like a password, ensuring that access to the API is restricted to authorized users only.
You can also create one by yourself in Console -> Developer Zone -> OAuth2

Authenticate using Authorization Header
To obtain authentication tokens use client_credentials grant type as mentioned below:
Authenticate using client credentials
POST https://{server_address}/oauth2/token
Authentication to Organization API using OAuth client credentials provided in Authorization header.
Query Parameters
grant_type*
Use client_credentials
Headers
Authorization*
Provide authorization header with OAuth client credentials filled in basic authorization format:
Basic {credentials}
Example response:
{
"access_token":"ct6Q2h1OiDHJaePbBgrpCgN3xfLPc9WYnCC6tRFd",
"token_type":"Bearer",
"expires_in":300,
"refresh_token":"fx8TlqzAxg5b8Ukzp46rD-FXpxrNxHKX3BZQjGhG"
}Use access_token value to authenticate further requests and refresh_token to refresh the token after its expiration. Use expires_in (value specified in seconds) parameter to determine token expiration time.
Example response:
{
"error": "invalid_client",
"error_description": "Client ID is not found or password is wrong."
}error parameter is one of: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type.
Usage example
cURL:
$ curl -X POST -u {clientId}:{clientSecret} https://{server_address}/oauth2/token?grant_type=client_credentialscURL with real data:
$ curl -X POST -u oa2-client-id_zmNtW-D0Toqpz4AZnBLCIlklBrz9ynU-:5uC5Y4Mcvdl5rB56rBmxnvB4DZgiIpcyTPbOoEWp https://fra1.blynk.cloud/oauth2/token?grant_type=client_credentialsToken Refresh using Authorization Header
After authentication token expiration use refresh_token grant type to refresh it:
Refresh authentication token
POST https://{server_address}/oauth2/token
Refreshing the authentication to Organization API using OAuth client credentials provided in Authorization header and refresh token issued in previous authentication response.
Query Parameters
refresh_token*
Refresh token, issued by previous authentication request
grant_type*
refresh_token
Headers
Authorization*
Provide authorization header with OAuth client credentials filled in basic authorization format:
Basic {credentials}
Example response:
{
"access_token":"ct6Q2h1OiDHJaePbBgrpCgN3xfLPc9WYnCC6tRFd",
"token_type":"Bearer",
"expires_in":300,
"refresh_token":"fx8TlqzAxg5b8Ukzp46rD-FXpxrNxHKX3BZQjGhG"
}Use access_token value to authenticate further requests and refresh_token to refresh the token after it's expiration. Use expires_in (value specified in seconds) parameter to determine token expiration time.
Example response:
{
"error": "invalid_client",
"error_description": "Client ID is not found or password is wrong."
}error parameter is one of: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type.
Usage example
cURL:
$ curl -X POST -u {clientId}:{clientSecret} https://{server_address}/oauth2/token?grant_type=refresh_token&refresh_token={refreshToken}cURL with real data:
$ curl -X POST -u oa2-client-id_zmNtW-D0Toqpz4AZnBLCIlklBrz9ynU-:5uC5Y4Mcvdl5rB56rBmxnvB4DZgiIpcyTPbOoEWp https://fra1.blynk.cloud/oauth2/token?grant_type=refresh_token&refresh_token=Esiu5g_OVc0ZxoH_F3X-4-lIoMvcU3yJjBN4QoQqAuthenticate using query parameters
Authentication using query parameters is easier but less preferred due to it's lower security. You may use this authentication type to achieve quick results as it can even be tested in a browser.
Using query parameters for authentication is easier and suitable for quick testing, including in a browser. However, it's less secure than other methods and not recommended for sensitive applications.
This method allows you to authenticate by directly appending your credentials to the URL as query parameters.
Authenticate using client credentials
POST https://{server_address}/oauth2/token
Authentication to Organization API using OAuth client credentials provided in query parameters.
Query Parameters
grant_type*
client_credentials
client_id*
String
OAuth client identifier
client_secret*
String
OAuth client secret
Example response:
{
"access_token":"ct6Q2h1OiDHJaePbBgrpCgN3xfLPc9WYnCC6tRFd",
"token_type":"Bearer",
"expires_in":300,
"refresh_token":"fx8TlqzAxg5b8Ukzp46rD-FXpxrNxHKX3BZQjGhG"
}Use access_token value to authenticate further requests and refresh_token to refresh the token after it's expiration. Use expires_in (value specified in seconds) parameter to determine token expiration time.
Example response:
{
"error": "invalid_client",
"error_description": "Client ID is not found or password is wrong."
}error parameter is one of: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type.
Usage example
cURL:
$ curl -X POST https://{server_addresss}/oauth2/token?grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret}cURL with real data:
$ curl -X POST https://fra1.blynk.cloud/oauth2/token?grant_type=client_credentials&client_id=oa2-client-id_zmNtW-D0Toqpz4AZnBLCIlklBrz9ynU-&client_secret=5uC5Y4Mcvdl5rB56rBmxnvB4DZgiIpcyTPbOoEWpToken Refresh using query parameters
Refresh authentication token
POST https://{server_address}/oauth2/token
To refresh authentication for the Organization API using query parameters, include your OAuth client credentials and the previously issued refresh token in the URL query string. This method is straightforward but less secure.
Query Parameters
grant_type*
refresh_token
refresh_token*
String
Refresh token, issued by previous authentication request
client_id*
String
oAuth client identifier
client_secret*
String
oAuth client secret
Example response:
{
"access_token":"ct6Q2h1OiDHJaePbBgrpCgN3xfLPc9WYnCC6tRFd",
"token_type":"Bearer",
"expires_in":300,
"refresh_token":"fx8TlqzAxg5b8Ukzp46rD-FXpxrNxHKX3BZQjGhG"
}Use access_token value to authenticate further requests and refresh_token to refresh the token after it's expiration. Use expires_in (value specified in seconds) parameter to determine token expiration time.
Example response:
{
"error": "invalid_client",
"error_description": "Client ID is not found or password is wrong."
}error parameter is one of: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type.
Usage example
cURL:
$ curl -X POST https://{server_address}/oauth2/token?grant_type=refresh_token&refresh_token={refreshToken}&client_id={clientId}&client_secret={clientSecret}cURL with real data:
$ curl -X POST https://fra1.blynk.cloud/oauth2/token?grant_type=refresh_token&refresh_token=pLa8jdJWHuCUfVniqNc8XimUs0gUZ8YuK_qsaUej&client_id=oa2-client-id_zmNtW-D0Toqpz4AZnBLCIlklBrz9ynU-&client_secret=5uC5Y4Mcvdl5rB56rBmxnvB4DZgiIpcyTPbOoEWpLast updated
Was this helpful?

