OAuth 2.0 overview
myCRMSIM implements the OAuth 2.0 authorization code flow with stateless JWT tokens. This page covers the moving pieces; the per-endpoint pages give you the exact request/response shapes.
Roles
Client — your app, requested under Integrations → Custom Integration and approved by myCRMSIM (gets a client_id + client_secret; the secret is shown once).
Authorization server — myCRMSIM (issues codes + tokens).
Resource server — the myCRMSIM API (validates the Bearer token on every call).
1. The install URL
https://app.mycrmsim.com/integrations/install/<CLIENT_ID>?redirect_uri=<YOUR CALLBACK>&state=<RANDOM>This is a dashboard URL, not an API-host URL — you redirect the user's browser to it. The user sees a consent screen listing the scopes your app is requesting. If they're not logged in, myCRMSIMbounces them to the login page with a returnUrl pointing back here. state is optional: it is passed through untouched and returned on the callback, so use it as your CSRF token.
2. The callback
HTTP/1.1 302 Found
Location: https://your-app.com/oauth/callback?code=4f8a7e1d2c9b3a5f6e0d1c2b7a8f9e6d&state=<YOUR STATE>Authorization codes are short, opaque, single-use, and expire 10 minutes after consent. Exchange the code for tokens right away (step 3). Each code can be redeemed only once — a second attempt to exchange the same code is rejected, so treat a code as consumed as soon as you use it.
HTTP/1.1 302 Found
Location: https://your-app.com/oauth/callback?error=access_denied&error_description=The+user+declined+the+installation.&state=<YOUR STATE>If the user clicks Cancel instead, the browser comes back with error=access_denied(plus your state) and no code. Nothing is installed; let them start again from the install URL.
3. Exchange (server-to-server)
curl -X POST https://backend.mysmsgateway.app/api/v1/third_party_integrations/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"code": "<CODE FROM CALLBACK>",
"client_id": "<YOUR CLIENT_ID>",
"client_secret": "<YOUR CLIENT_SECRET>",
"redirect_uri": "https://your-app.com/oauth/callback"
}'4. Calling the API
curl https://backend.mysmsgateway.app/api/v1/integration/me \
-H "Authorization: Bearer <ACCESS_TOKEN>"5. Refresh
curl -X POST https://backend.mysmsgateway.app/api/v1/third_party_integrations/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "refresh_token",
"refresh_token": "<REFRESH_TOKEN>",
"client_id": "<YOUR CLIENT_ID>",
"client_secret": "<YOUR CLIENT_SECRET>"
}'Access tokens last 24 hours, refresh tokens 1 year. Every refresh returns a new access + refresh pair — store the newest pair. Tokens are stateless signed JWTs, so the previous refresh token is not invalidated by rotation: it stays valid until its own expiry or until the installation is suspended. That also makes a refresh safe to retry with backoff after a timeout or 5xx. The token endpoints are outside the per-installation API rate limits and never answer 429.
Revocation
SuperAdmins can revoke an installation at any time. All issued tokens for that install will immediately fail with a 401. The user has to be sent through the install URL again to re-consent and get fresh tokens. There is no client-facing uninstall endpoint yet: if you drop an installation on your side, discard its tokens and contact support to have it suspended.
