Get started with Monitask API
Steps to get started with Monitask API:
- Navigate to the https://app.monitask.com/developer (developer) page and click “Add new app” button.
- You will be redirected to application registration page where you’ll need to specify basic details for your app:
Fill App Name and Redirect Uri, optionally fill Logo Uri and Website Uri and click Create.
- Now you are redirected to the app details page. You will also be able to access it from developer page later
Here you can manage redirect uris, scopes and secrets of your app
- Click Add Secret button
Then copy it and save securely. You will not be able to obtain this secret again
- Add openid scope and click Save
- Copy Client Id from this page
- Then, you can build an OAuth URL with the following structure:
https://app.monitask.com/identity/connect/authorize?client_id=<yourclientid>&scope=<your_scopes> &response_type=code&redirect_uri=<your_redirect_uri>
Example of such URL:
https://app.monitask.com/identity/connect/authorize?client_id=437bfbf0d2fd41479e671cdf643aa5ad&scope= profile%20email%20openid%20offline_access%20ExternalApi&response_type=code&redirect_uri=http://localhost:5000/monitask/callback
- When you open this URL you will see a Monitask sign in page:
Sign in to your account
You will be redirected to your application permissions page:
Click Yes, Allow
- You are redirected to the specified redirect_url with oauth code:
- You can make an HTTP POST request to the https://app.monitask.com/identity/connect/token with the following data:
Basic Auth. Username is your client_id, Password is your client_secret
Body is form-urlencoded with grant_type=authorization_code, redirect_uri is your redirect_uri and code is the code you obtained in oauth dance
When you execute this request you obtain access_token and refresh_token
- You can use obtained access_token for querying our API:
Add it as a bearer authorization to your request
- Since access token expires after 1 hour, you need to refresh it using the refresh token. To do so, you can use the refresh_token you obtained in the previous “token” request:
- You’ll need to make a request to https://app.monitask.com/identity/connect/token
With the same basic auth but with the following body:
Grant_type=refresh_token
Redirect_uri is your redirect uri
Refresh_token is refresh token you received before
When request is executed you will obtain new access and refresh tokens