Integrate Basic into your project using REST APIs
Use "redirect to sign in" endpoint
client_id='YOUR_CLIENT_ID'
redirect_uri='YOUR_REDIRECT_URI'
response_type=code
scope=profile
state='YOUR_STATE'
https://api.basic.tech/auth/authorize?response_type=code&redirect_uri=YOUR_REDIRECT_URI&scope=profile&state=YOUR_STATE&client_id=YOUR_CLIENT_ID
YOUR_CLIENT_ID
, YOUR_REDIRECT_URI
, YOUR_STATE
with your own valuesExtract code from URL
code
query parameter.
For example:
https://your-app.com/callback?code=1234567890
.You need to extract the code from the URL and use it in the next step.Use "get auth token" endpoint with extracted code
/auth/token
with the authorization code in the body. The response will be a JSON object with the access token and a refresh code.Token URL template:
https://api.basic.tech/auth/token
YOUR_CODE
with your own valuesStore auth token object for future API calls
access_token
, and pass it in the Header of your API call.
If the access_token
is expired, you’d repeat step 3 of the Auth APIs guide but using the refresh_token
instead of the extracted code. This will return you a fresh new access_token
.
Here’s how to validate and use the access token in different programming languages: