Thanks.io supports OAuth 2.0 for secure authentication and authorization. This allows users to grant your application access to their thanks.io account without sharing their credentials.
To integrate OAuth 2.0 with your application, follow these steps:
Create an account on thanks.io: Create account HERE if you haven’t already.
Register your OAuth Client: Go to the thanks.io API Settings and register your application in the “OAuth Clients” section to obtain your client ID and client secret.
Redirect user to authorize your application: When a user wants to connect their thanks.io account to your application, redirect them to the thanks.io authorization endpoint with the following parameters:
Copy
GET https://dashboard.thanks.io/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI
Request your client’s access token: After the user authorizes your application, they will be redirected back to your specified redirect URI with an authorization code. You’ll use this AUTHORIZATION_CODE to request an access token:
Copy
POST https://dashboard.thanks.io/oauth/tokenContent-Type: application/x-www-form-urlencodedgrant_type=authorization_code&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&redirect_uri=YOUR_REDIRECT_URI&code=AUTHORIZATION_CODE
Store the tokens securely: The response will include an access token, refresh token, and expiration time. Store these tokens securely.
Handle Token Expiration: Access tokens have a limited lifespan. Implement token refresh logic to obtain new tokens using the refresh token flow.
Copy
POST https://dashboard.thanks.io/oauth/tokenContent-Type: application/x-www-form-urlencodedgrant_type=refresh_token&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&refresh_token=YOUR_REFRESH_TOKEN