Skip to main content
OAuth gives an app its own access token after you approve its permissions. Your private API key stays on the AlexWeb approval page. First register an application. OAuth here connects to AlexWeb, rather than signing in with Google.

Connect an app

  1. Your app generates a random code verifier and its SHA-256 code challenge. This is called PKCE.
  2. It opens /oauth/authorize in a browser with the parameters below.
  3. You review the permissions, enter your API key on that page and choose Connect app.
  4. The browser returns to the registered callback with a one-time code, your state value and iss. Your app checks that state matches and the issuer is https://api.alexxweb.com.
  5. Your app exchanges the code and original verifier for tokens.
Use a verifier of 43–128 URL-safe characters. S256 PKCE is required for public and confidential apps.

Try it

After approval, a public app exchanges its code like this. Replace every placeholder with the values from that same connection attempt.
A confidential app also authenticates with -u "CLIENT_ID:CLIENT_SECRET". Keep that secret on its server.

What you’ll see

  • access_token works in Authorization: Bearer ACCESS_TOKEN.
  • expires_in is its lifetime in seconds: up to 15 minutes.
  • refresh_token gets a replacement access token. Save it privately.

Refresh access

Save the new refresh token each time; the previous one stops working. The connection lasts up to 30 days after its original approval, and ends sooner if the approving key expires or is revoked. The user must then approve again.

Server apps

A confidential app can use client_credentials for its own approved permissions:
This grant returns an access token without a refresh token.

Other requests

Revoke a public app’s refresh token with form fields token=REFRESH_TOKEN and client_id=CLIENT_ID. A confidential app also uses HTTP Basic authentication. Revoking a refresh token removes the connection’s access tokens too. Token requests use form data. OAuth failures use error and error_description, such as invalid_grant for an expired code.