Enterprise feature. OAuth 2.0 is available on the Enterprise plan. Contact your Penbox account manager to enable it.
OAuth 2.0 clients are provisioned by Penbox. There is no self-service screen to create one yet. Contact support@penbox.io with your application name, logo, website and the HTTPS redirect URI(s) you will use. You receive a
client_id and a client_secret in return.How it works
Penbox supports the Authorization Code flow, with refresh tokens.Endpoints
The authorization and token endpoints live at the root of the host, not under
/v1. The server metadata is published at /.well-known/openid-configuration.
Step 1: Send the user to Penbox
Redirect the user’s browser to/authorize:
The user signs in, selects the workspace to authorize, and approves your application.
Step 2: Receive the authorization code
Penbox redirects the user back to yourredirect_uri:
state matches what you sent. If something went wrong, the redirect carries error and error_description instead of code.
Step 3: Exchange the code for tokens
CallPOST /token from your server with your credentials:
application/x-www-form-urlencoded. Instead of the body, you can also send the credentials with HTTP Basic authentication (Authorization: Basic base64(client_id:client_secret)).
If you sent a redirect_uri in step 1, send the same value here.
Response:
Step 4: Call the API
Use the access token exactly like a personal API token:Refreshing the access token
Before the access token expires, request a new one:access_token. The refresh token stays the same, so keep storing it.
If the refresh token is rejected (
400), send the workspace admin through the authorization flow again.Errors
At the
/authorize step, errors are sent back to your redirect_uri as error and error_description. If the redirect_uri itself is invalid, the error is shown to the user instead of redirecting.
Security checklist
- Store
client_secretand refresh tokens in a secrets manager, never in source control or client-side code. - Always send and verify
state. - Register exact HTTPS redirect URIs.
- Keep one access token and one refresh token per authorized workspace.
- Ask Penbox to rotate your
client_secretif it may have leaked.
Next steps
Bearer token authentication
Use a personal API token for your own workspace
Error Codes
HTTP status codes returned by the API