Authentication

POST /token/

MainBrainer supports JWT Bearer Authentication to authenticate all API requests. Herein, all your API requests must pass an additional ‘access token’ in their Authorization header. This helps you add an additional layer of security to your account.

A sample authorization header should look like the following:

Copy
Copied
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiMTA4NyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWVpZGVudGlmaWVyIjoiMTA4NyIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InVzZXIiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9kbnMiOiJsb2NhbGhvc3QsKi5sb3lhbHR5Y29tbXVuaWNhdGlvbi5jb20iLCJ1c3IiOiJQQUlBQUIrTENBQUFBQUFBQUFObFVzbHUyekFRL1pXQzEwaXhaR28vMVZVYXdLanRCb25iSGd1S0dzV0V1UmhjRGtMUWZudUh0bU1FS0c5OHl3em5EZC9JZWlSZG5qVjFRblpNQWVuSVNnbi82ZVhBckdJa0lWOFZFeEpSaHVoZGNKK2xtWm4wTXpkS0JTMDQ4OExvZTd5aGRNVTVPTGMzUjlCb3lNYUtVemJrNmREVVBDMmdtdEloYTl1MDRQVzBwRkRtUmQxY1RDWm8vNkgzYjBwTFNpdmt0c3dld2NjSGtrMWFJOURqcTE3Rk5QZkJlYVBBUnFvb2x4V3RHcHFRdGRzZ0RkZUtwSnVZZElDbUlIMncwSnN4ZGdDZHJuZFk2dWxnTk95Q0dzQWkyclpOMDlSRmtXZXhpd1htWWZ3eWswNEhLUlB5WTkvdmhZTHYwK1FBNjhiN1hWWjJOUHU3Y29JdHZobDVaRDZHOVlDK1I0UEJSZFYydXhqSHhZd0htWitDYWZEK0dTYXdvRG1zSDk2TC84ODgvYnFSdlZFbnB1ZHJPcHRMenZzREtJaWpad2tKVnR5MFRFcWhYMWVuazd6dUJSZUxnMW96Qm41T3NTeXFLczhRZXdtRDQxYWNvdWljWVpIWEZhM2JtL29SMXkzRmZQNGJWZHUyU3pUZHhyL01Udjc4QTY2U1dXbzhBZ0FBIiwiVVRDVGltZU9mZnNldCI6IlVUQyswNTozMH5Bc2lhL0tvbGthdGEiLCJDdWx0dXJlQ29kZSI6ImVuLUlOIiwiZmFtaWx5X25hbWUiOiJBbWl0IFNoYXJtYSIsImVtYWlsIjoiYW1pdCt1c0Bsb3lhbHR5Y29tbXVuaWNhdGlvbi5jb20iLCJ3ZWJzaXRlIjoibG9jYWxob3N0LCoubG95YWx0eWNvbW11bmljYXRpb24uY29tIiwianRpIjoiNTRlMjhlNGMtNTdiZC00MjEwLWEwYjktNWM1ZjA0MmQwZjk5IiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9leHBpcmF0aW9uIjoiMjAyMS0wNy0xOSAxMDo0MDo0Ni41OTAiLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL2V4cGlyZWQiOiIyMDIxLTA5LTE3IDEwOjQwOjQ2LjU5MCIsIm5iZiI6MTYyNjY5MTI0NiwiZXhwIjoxNjMxODc1MjQ2LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjQ0MzA2LyIsImF1ZCI6IkFwaXYyIn0.sh-ojd0-6DSHhdjhpfkDoR-89JgBMyDmMabZf9hnUPc
Method Details
HTTP Method POST
Content type Application/json
End Point

https://authenticate.mainbrainer.com/token

How to create an access token:

Required Parameters Usage Description
UserName userName = login email which you have used to login in platform This parameter specifies the email address with which your account is registered on MainBrainer.com
Password password = your account password This parameter specifies the password you use to access your MainBrainer account.
privateToken unique key which used to identified your Account This parameter specifies the private token assigned to your MainBrainer account. To get your account’s private token, log into your MainBrainer account and get your account’s private token from the Account Configuration menu.
Validity validity = Set a token Expiry This parameter defines the period for which you want your access token to remain valid. It can take the following values: Default – for a validity period of 12000 minutes , ShortLive - for a validity period of 30 seconds, LongLive- for a validity period of 120 months
Copy
Copied

This example demonstrates how to request token
post url: https://authenticate.mainbrainer.com/token

{
"userName": "[email protected]",
"password": "yourpassword",
"privateToken": "0d6c3ab1-b87c-4e6f-b099-4c7f23e51478",
"validity": "Default"
}

Returns a 200 Success response with content on success.
    

Response Body

Copy
Copied
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiMTA4NyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWVpZGVudGlmaWVyIjoiMTA4NyIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InVzZXIiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9kbnMiOiJsb2NhbGhvc3QsKi5sb3lhbHR5Y29tbXVuaWNhdGlvbi5jb20iLCJ1c3IiOiJQQUlBQUIrTENBQUFBQUFBQUFObFVzbHUyekFRL1pXQzEwaXhaR28vMVZVYXdLanRCb25iSGd1S0dzV0V1UmhjRGtMUWZudUh0bU1FS0c5OHl3em5EZC9JZWlSZG5qVjFRblpNQWVuSVNnbi82ZVhBckdJa0lWOFZFeEpSaHVoZGNKK2xtWm4wTXpkS0JTMDQ4OExvZTd5aGRNVTVPTGMzUjlCb3lNYUtVemJrNmREVVBD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xODc1MjQ2LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjQ0MzA2LyIsImF1ZCI6IkFwaXYyIn0.sh-ojd0-6DSHhdjhpfkDoR-89JgBMyDmMabZf9hnUPc",
  "token_type": "Bearer",
  "expires_in": 5184000,
  "userName": "tom",
  ".issued": "2021-07-19T10:40:46Z",
  ".expires": "2021-09-17T10:40:46Z",
  "timeZoneOffset": "UTC+05:30~Asia/Kolkata",
  "locale": "en-US"
}