Authentication methods
API uses OAuth 2.0 authorization protocol through HTTPS.
1. Scope
Scope let you specify exactly what type of access you need (space-separated list).
In order to be able to access a certain resource (endpoint), a request MUST have an access token with the necessary scope granted. Not all scopes must be granted. Always check `scope` in access_token response.
For more information on which scopes are needed for a certain endpoint, please refer to the Scopes page.
Scopes limit access for OAuth tokens and they do not grant any additional permission beyond that which the user already has defined in MyQ.
2. Additional Grant Types
2.1. User login
Request an access token by providing a "login_info" object with a valid user credential.
Example Auth Request
Endpoint:
POST /api/auth/token
Headers:
Content-Type:application/json
Body:
{
"grant_type": "login_info",
"scope": "jobs offline.access",
"client_id": "7B4CD3C2-F57E-4D52-A90A-23EED001CE81",
"client_secret": "89fbf537fe689fca26f67abae7a557106f4348d5",
"login_info": {
"type": 2,
"pin": "1234"
}
}
Login Info grant allows requests for access tokens by providing user credentials, but different from Password grant, this request must have a "login_info" object. This object allows log in by using one of the valid users login options, here are some login info objects examples for each login type:
2.1.1. User Card
LoginInfo object required properties
"login_info": {
"type": 1,
"card": "123456"
}
2.1.2. User Pin
LoginInfo object required properties
"login_info": {
"type": 2,
"pin": "1234"
}
2.1.3. User and Password
LoginInfo object required properties
"login_info": {
"type": 3,
"user": "user",
"pwd": "password"
}
2.1.4. Card and Pin
LoginInfo object required properties
"login_info": {
"type": 4,
"card": "123456",
"pin": "1234"
}
2.1.5. Card and Password
LoginInfo object required properties
"login_info": {
"type": 5,
"card": "123456",
"pwd": "password"
}
2.2. Client login
Request token by using client_credentials
.
Endpoint:
POst /api/auth/token
Headers:
Content-Type:application/json
Body:
{
"grant_type": "client_credentials",
"scope": "jobs offline.access",
"client_id": "7B4CD3C2-F57E-4D52-A90A-23EED001CE81",
"client_secret": "89fbf537fe689fca26f67abae7a557106f4348d5",
}
3. Retrieving an access token
Authentication token endpoint: POST /api/auth/token
If authentication happens, you'll receive an access token that must be provided at any other API endpoint.
Example Response
{
"access_token": "your_bearer_token",
"token_type": "Bearer",
"expires_in": 1800,
"scope": "jobs offline.access",
"refresh_token": "your_refresh_token"
}