Overview
OAuth2 allows your application to securely access user data on behalf of the user.Prerequisites
- Obtain your
client_idandclient_secretfrom the partner portal. - Configure a Redirect URI in the portal — this is where users are sent after authorizing your app.
Authentication Flow
1. Redirect the user to the authorization server
Send users to the authorization endpoint where they can log in and approve access. GET https://auth.calendbook.com/login2. User login & consent
The user logs in (if not already) and approves the requested scopes.3. Receive authorization code
After approval, the user is redirected back to your configuredredirect_uri with a short-lived authorization_code.
4. Exchange authorization code for access token
Make a POST request to the token endpoint: https://auth.calendbook.com/oauth2/token-
Headers:
Content-Type: application/x-www-form-urlencoded - Body (x-www-form-urlencoded):
- Response Body:
- access_token
- refresh_token
5. Call the API
- Use the
access_tokenin the Authorization header
6. Refresh token
When the access_token expires, request a new one with the refresh_token:- POST https://auth.calendbook.com/oauth2/token
-
Headers:
Content-Type: application/x-www-form-urlencoded - Body (x-www-form-urlencoded):
access_token