Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use your applicationyour application's credentials and the userthe user's credentials to retrieve an access token by sending a HTTP POST message to https://app1pub.smappee.net/dev/v1/oauth2/token

 

Code Block
POST /dev/v1/oauth2/token HTTP/1.1
Host: app1pub.smappee.net
Content-Type: application/x-www-form-urlencoded;charset=UTF-8

grant_type=password&
client_id=[YOUR_APP_ID]&
client_secret=[YOUR_CLIENT_SECRET]&
username=[USER_NAME]&
password=[USER_PASSWORD]
        

Note : (info) for readability the above parameters are separated by CRs, in practice the HTTP body should be one concatenated string separating the key value pairs with a &

If the server side validation of the passed credentials went well, you will receive a HTTP OK containing the token information (see below). This token has to be passed with each successive API call. The token has an expiry period of 10 hours (36000 seconds). After the token has expired, you can use the refresh token to retrieve a new access token. 

Code Block
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
    "access_token":"5fd0cf9a-fd95-38d3-a391-887b0dfa8e86",
    "expires_in": 36000,
    "refresh_token":"326ce36a-c101-356e-9686-b695bf924f0d",
}

The response contains the access token that needs to be passed with successive API calls. The access token will expire after the specified number of seconds. Your application will not be able to use the token after, in this example, 36000 seconds (10 hours). After the token has expired, you can use the refresh token to retrieve a new access token

...