oauth

Generate a token

Generate a token for usage with authenticating via OAuth2 in subsequent API calls.

Supports the following grant types:

  • client_credentials — exchange client ID and secret for an access token.
  • authorization_code — exchange an authorization code (from the OAuth2 authorize flow) for an access token and refresh token. Requires code, redirect_uri, and optionally code_verifier (for PKCE) and state.
  • refresh_token — exchange a refresh token for a new access token and refresh token.

Note: This endpoint is available at the absolute URL /oauth/token (not relative to the versioned API base path).

post/oauth/token

Request

  • Base URL
    https://{tenant_name}.benchling.com
  • Auth
    HTTP bearer

Request body

client_idstring

ID of client to request token for. Leave off if client ID and secret are being supplied through Authorization header.

client_secretstring

Leave off if client ID and secret are being supplied through Authorization header.

codestring

Authorization code received from the authorize endpoint. Required when grant_type is authorization_code.

code_verifierstring

PKCE code verifier. Required when grant_type is authorization_code and a code_challenge was sent in the authorization request.

grant_type'client_credentials' | 'authorization_code' | 'refresh_token' required
redirect_uristring

Redirect URI that was used in the authorization request. Required when grant_type is authorization_code.

refresh_tokenstring

Refresh token to exchange for a new access token. Required when grant_type is refresh_token.

statestring

Optional state parameter for the authorization_code grant type.

Response

Generated token

access_tokenstring required
expires_ininteger required

Number of seconds that the access token is valid for

refresh_tokenstring

Refresh token. Returned when grant_type is authorization_code or refresh_token.

refresh_token_expires_ininteger

Number of seconds that the refresh token is valid for. Returned when a refresh_token is included in the response.

token_type'Bearer' required

Changes

No recorded changes to this operation across all 1 revision of this API.