Using Proof Key for Code Exchange (PKCE)

View as Markdown

The User Authorization use case supports Proof Key for Code Exchange (PKCE) . Use PKCE when you don't have a backend server for user authorization, such as in a native app that runs on mobile (Android or iOS) or desktop (Linux, macOS, or Windows). Zoom issues a separate public client ID for this flow. Send it as client_id. It has no client secret.

Get your public client ID

  1. Open your app and navigate to App Credentials under Basic Information.
  2. Toggle Use Public Client OAuth to on.
  3. Copy the public client ID. Send that value as client_id on the authorization request and on the token request. Do not Base64-encode it, and do not send a client secret or an Authorization header. Base64(using client_id:client_secret) is only for confidential clients.

PKCE authorization flow

Generate a code_verifier, a cryptographically random string, locally in your client. Derive a code_challenge from it. For S256, take the SHA-256 hash of the code_verifier and Base64URL-encode it. Use your platform's crypto library, for example CryptoKit on iOS, MessageDigest on Android, or crypto.subtle in browsers.

Send the user to the authorization URL with your public client ID, code_challenge, and code_challenge_method:

https://zoom.us/oauth/authorize?response_type=code&client_id=ZOOM_PUBLIC_CLIENT_ID&redirect_uri=REDIRECT_URI&code_challenge=CODE_CHALLENGE&code_challenge_method=S256

After the user clicks Allow on the consent screen, Zoom redirects to your redirect_uri with an authorization code.

To exchange the code for an access token, send a POST request to https://zoom.us/oauth/token. Unlike the confidential client flow, PKCE does not use an Authorization header or a client secret, so your app sends this request directly from the client without a backend server. Send all fields in the request body as application/x-www-form-urlencoded.

KeyValue
grant_typeauthorization_code
codeThe authorization code from the redirect.
client_idYour public client ID.
redirect_uriThe same redirect URI used in the authorization request.
code_verifierThe original code_verifier.

If successful, the response body contains the access_token, refresh_token, and a token_type of bearer. You can now make authorized API requests.

Refresh and revoke tokens

PKCE public clients refresh and revoke tokens with the same endpoints as confidential clients. A public client has no client secret, so it does not send a basic authorization header. Instead, send your public client ID as client_id in the request body.

Refresh an access token

Access tokens expire after one hour. To get a new access token, send a POST request to https://zoom.us/oauth/token. Send all fields in the request body as application/x-www-form-urlencoded.

KeyValue
grant_typerefresh_token
refresh_tokenYour latest refresh_token.
client_idYour public client ID.

Here is an example request.

POST https://zoom.us/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token
&refresh_token=YOUR_REFRESH_TOKEN
&client_id=YOUR_PUBLIC_CLIENT_ID

If successful, the response body contains a new access_token and a new refresh_token. Always use the latest refresh token for the next refresh request. Refresh tokens expire after 90 days. If your refresh token expires, restart the PKCE authorization flow.

Revoke an access token

To revoke an access token, send a POST request to https://zoom.us/oauth/revoke. Send all fields in the request body as application/x-www-form-urlencoded.

KeyValue
tokenThe access_token to revoke.
client_idYour public client ID.

Here is an example request.

POST https://zoom.us/oauth/revoke
Content-Type: application/x-www-form-urlencoded

token=YOUR_ACCESS_TOKEN
&client_id=YOUR_PUBLIC_CLIENT_ID

If successful, the response body confirms that Zoom revoked the token.

{
  "status": "success"
}

PKCE parameter reference

See the Proof Key for Code Exchange by OAuth Public Clients  RFC for full details.

KeyDescription
code_verifierA cryptographically random string generated locally by the client. Sent in the access token request so Zoom can validate the previously received code_challenge.
code_challengeA challenge derived from the code_verifier. Sent in the authorization request.
code_challenge_methodThe method used to derive the code_challenge. Public clients must send S256 in the authorization request. RFC 7636 defaults an omitted method to plain. Do not omit the parameter, and do not send plain.

Detailed justification for PKCE

If you make your app public, you may need to add an explanation why your application requires a public client ID in production. This helps our application review team test your PKCE integration and confirm your intended OAuth flow. Indicate whether you plan to use:

  • The confidential client OAuth flow (for example, a web app with a backend),
  • The public client OAuth PKCE flow (for example, a mobile or desktop app), or
  • Both.

This information ensures our security team can validate your configuration according to your intended use.

Using a loopback redirect URI

Native applications, desktop clients, CLI tools, and local development environments, can use a loopback redirect URI to receive the OAuth authorization response without exposing a publicly reachable endpoint. This approach follows the security recommendations in RFC 8252, OAuth 2.0 for Native Apps .

With a loopback redirect, your application starts a temporary local HTTP server, directs the user's system browser to Zoom's authorization endpoint, and captures the authorization code when the browser redirects back to http://127.0.0.1:{port}/{path}. To implement, create the HTTP server first (e.g. on port 0), read the assigned port, then open the browser.

Eligibility

  • Use loopback for PKCE-enabled clients and native app clients. A PKCE-enabled client has Use Public Client OAuth turned on and sends the public client ID instead of a Base64-encoded client ID and secret. Zoom matches loopback redirect URIs while ignoring only the port. The scheme, numeric loopback host, path, query, and user info must otherwise match the registered URI exactly.
  • Do not use loopback for confidential OAuth apps that are not PKCE-enabled. Those apps must keep using HTTPS redirect URIs. The authorize endpoint returns: Invalid redirect: <redirectUri>.

When to use loopback redirection

Use this method when your application runs locally on the user's machine and cannot receive inbound HTTPS callbacks from the internet. Common scenarios include:

  • Desktop applications (Electron, native GUI apps)
  • Command-line interface (CLI) tools
  • Local development and testing environments

Prerequisites

  • A registered Zoom Marketplace OAuth app.
  • Proof Key for Code Exchange (PKCE) enabled — required for all public/native clients.
  • A redirect URL saved on the public client. When Use Public Client OAuth is enabled, Marketplace keeps that URL on the public client. It is not copied from the confidential client's OAuth Redirect URL, and changing the confidential URL does not change the public client's URL. The OAuth allow list is still shared by the confidential client and the public client in the same development or production app.

Create a loopback redirect URI

  1. Generate a PKCE code verifier and challenge. Create a cryptographically random code_verifier (43–128 characters) and derive the code_challenge using the S256 method.

  2. Start the local HTTP server - Bind to 127.0.0.1:0 to get an ephemeral port.

  3. Read the assigned port - Get the actual port from the server (e.g., 52936). The port may vary on each run.

  4. Construct the redirect URI. Build the URI using the loopback IP literal and the selected port:

    http://127.0.0.1:52936/callback
    
  5. Launch the system browser. Open the user's default browser to Zoom's authorization endpoint with the required parameters:

    https://zoom.us/oauth/authorize?response_type=code
    &client_id=YOUR_PUBLIC_CLIENT_ID
    &redirect_uri=http://127.0.0.1:52936/callback
    &code_challenge=YOUR_CODE_CHALLENGE
    &code_challenge_method=S256
    &state=YOUR_RANDOM_STATE
    
  6. Capture the redirect. After the user authorizes, Zoom redirects the browser to your local listener. Extract the code and state query parameters from the incoming request.

  7. Validate the state parameter. Confirm that the returned state matches the value you sent in step 5.

  8. Exchange the code for tokens. Send a POST request to the token endpoint with the authorization code, redirect URI, and PKCE code verifier:

    POST https://zoom.us/oauth/token
    Content-Type: application/x-www-form-urlencoded
    
    grant_type=authorization_code
    &client_id=YOUR_PUBLIC_CLIENT_ID
    &code=AUTHORIZATION_CODE
    &redirect_uri=http://127.0.0.1:52936/callback
    &code_verifier=YOUR_CODE_VERIFIER
    
  9. Shut down the listener. Close the local HTTP server immediately after receiving the redirect.

Register a loopback redirect URI

Register the loopback URI as the public client's redirect URL, or add it to the shared OAuth allow list.

  • Do not register it only as the confidential client's OAuth Redirect URL.
  • Register one loopback URI for each host and path your app will send.
  • Use a numeric loopback literal (127.0.0.1 or [::1]); do not use localhost. 127.0.0.1 is an IPv4 address and [::1] is an IPv6 address; Zoom treats them as distinct hosts and does not match one against the other, so you must register each one you intend to use.
  • An authorize request that sends the public client ID must use a redirect_uri that matches the public client's redirect URL or an entry on the shared allow list. Zoom accepts, for each client, that client's own redirect URL and then the shared allow list.
  • Zoom ignores only the port; the scheme, host, path, query, and user info must match exactly.

These formats are accepted for PKCE or native-style clients:

http://127.0.0.1
http://127.0.0.1:3000
http://127.0.0.1/callback
http://127.0.0.1:8080/callback
http://[::1]
http://[::1]:60123/callback

Other considerations

  • Use 127.0.0.1, not localhost. The loopback IP literal avoids DNS resolution issues and prevents unintended network exposure. RFC 8252 explicitly recommends against using localhost for this reason.
  • Bind only to the loopback interface. Never bind the listener to 0.0.0.0 or a public interface.
  • Close the listener immediately. Shut down the local HTTP server as soon as you receive the authorization response to minimize the window of exposure.
  • Always use PKCE. The code verifier and challenge mechanism prevents authorization code interception attacks, which are especially relevant for native apps where the client secret cannot be kept confidential.
  • Validate the state parameter. Always compare the returned state to the value you generated to prevent CSRF attacks.
  • Handle port conflicts gracefully. If the initially selected port becomes unavailable, retry with a different ephemeral port before presenting an error to the user.
  • Handle common errors. Show a clear message to the user for errors such as a redirect URI mismatch (wrong host or path), a client that is not eligible for loopback (not PKCE-enabled), the browser failing to open, or the user closing the browser before authorizing.
  • Do not cache or reuse the listener port. Select a fresh ephemeral port for each authorization attempt.
  • Treat the authorization code as single-use. If it expires or the token request fails, start a new authorization. Do not replay the same code.