Details
Quick Overview
You would need to have Client Id and Client Secret handy.
The endpoint for user authorization is https://auth.smarttask.io/connect/authorize
The endpoint for token exchange is https://auth.smarttask.io/connect/token
SmartTask supports the Authorization Code Grant flow.
Once an access token has been obtained your application can make calls on behalf of the user
User Authorization Endpoint
Request
Send a user to authorize
Your app redirects the user to https://auth.smarttask.io/connect/authorize, passing parameters along as a standard query string:
Response
If either the client_id
or redirect_uri
do not match, the user will simply see a plain-text error. Otherwise, all errors will be sent back to the redirect_uri
specified.
The user then sees a screen giving them the opportunity to accept or reject the request for authorization. In either case, the user will be redirected back to the redirect_uri
.
User is redirected to the redirect_uri
When using the response_type=code
, your app will receive the following parameters in the query string on successful authorization.
You should check that the state is the same in this response as it was in the request.
OAuth Scopes
The SmartTask API supports a small set of OAuth scopes you can request using the scope
parameter during the user authorization step of your authentication flow. Multiple scopes can be requested at once as a space-delimited list of scopes. An exhaustive list of the supported scopes is provided here:
Token Exchange Endpoint
Request
When your app receives a code from the authorization endpoint, it can now be exchanged for a proper token.
If you have a client_secret
, this request should be sent from your secure server. The browser should never see your client_secret
.
App sends request to token
Your app should make a POST
request to https://auth.smarttask.io/connect/token
, passing the parameters as part of a standard form-encoded post body.
The token exchange endpoint is used to exchange a code or refresh token for an access token.
Response
In the response, you will receive a JSON payload with the following parameters:
Decode Access Token
Decoding jwt access_token you would find following details of the user:
Authorization Code Grant
To implement the Authorization Code Grant flow (the most typical flow for most applications), there are three steps:
Send the user to the authorization endpoint so that they can approve access of your app.
Receive a redirect back from the authorization endpoint with a code embedded in the parameters
Exchange the code via the token exchange endpoint for a
**refresh_token**
and, for convenience, an initialaccess_token
.When the short-lived
access_token
expires, the**refresh_token**
can be used with the token exchange endpoint, without user intervention, to get a freshaccess_token
.
The access token that you have at the end can be used to make calls to the SmartTask API on the user's behalf.
Secure Redirect Endpoint
As the redirect from the authorization endpoint in either grant procedure contains a code that is secret between SmartTask's authorization servers and your application, this response should not occur in plaintext over an unencrypted http
connection. We're enforcing the use of https
redirect endpoints.
For non-production or personal use, you may wish to check out stunnel, which can act as a proxy to receive an encrypted connection, decrypt it, and forward it on to your application. For development work, you may wish to create a self-signed SSL/TLS certificate for use with your web server; for production work we recommend purchasing a SSL certificate.
Last updated