Cortex API
Search…
⌃K

authorize

This method is to generate a Cortex access token. Most of the methods of the Cortex API require this token as a parameter.
Application can specify the license key and the amount of sessions to be debited from the license and use them locally.
The token is linked to your application. It cannot be used with another application. The token is also linked to the EmotivID of the current user. It cannot be used with another EmotivID. So if the user logs out in EMOTIV Launcher, and then logs in with another EmotivID, your application must call this API again to get a new token.
Your application can save the Cortex token and reuse it later, within 2 days. Note that it is the responsibility of the application to secure the token.
If the user has not accepted the EULA, then a warning message will be included in the response as well. The user must accept the EULA through EMOTIV Launcher.
Before you call this method, the user must approve your application in EMOTIV Launcher. See requestAccess for details.
The Cortex token must remain secret. Do NOT share it. It is your responsibility to keep it secure.

Parameters

Name
Type
Required
Description
clientId
string
yes
The client id of your Cortex application.
clientSecret
string
yes
The client secret of your Cortex application.
license
string
no
A license id. In most cases, you don't need to specify the license id. Cortex will find the appropriate license based on the client id.
debit
number
no
Number of sessions to debit from the license, so that it can be spent locally without having to authorize again. You need to debit the license only if you want to activate a session. The default value is zero.

Result

The result is an object containing a field cortexToken. It may also include a field warning, if the user didn't accept the EULA.
Name
Type
Description
cortexToken
string
The Cortex token of the user
warning
object
Contains a message and the URL to accept the EULA

Examples

Request
Response
{
"id": 1,
"jsonrpc": "2.0",
"method": "authorize",
"params": {
"clientId": "xxx",
"clientSecret": "xxx"
}
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"cortexToken":"xxx",
"warning": {
"code": 6,
"message": "...",
"licenseUrl": "https://..."
}
}
}