The connection flow
Base URLs and endpoints
1Password has two hosts. The person’s browser goes to the web origin to sign in and consent. Your backend calls the API origin for tokens and revocation.
Test against these production origins. The development environment,
b5dev.eu, can’t show approval prompts with current 1Password app builds, and its tokens and integration keys don’t work on production.
Everyone authorizes at the environment’s web origin, regardless of their account address. A person whose account is at
acme.1password.com still authorizes at https://my.1password.com. Don’t ask the person for their account address or build an origin from it.
Register your redirect URI
Register your callback on your OAuth client, then send it character for character in every authorize and token request. The console doesn’t show the registered value again, so record it when you create the client. A redirect URI must usehttps and a hostname, with no user info and no fragment. Custom URL schemes and http://localhost aren’t accepted. A native mobile app needs an https callback, such as a universal link or app link, or a web page that hands the result back to the app.
Start authorization
Redirect the person’s browser to the authorize endpoint:string
required
Always
code.string
required
Your OAuth client ID. It isn’t a secret.
string
required
Exactly one of the redirect URIs registered on your client, URL-encoded.
string
required
The two scopes, space-delimited:
brokered-credentials:request-access brokered-credentials:read. Encode the separating space as %20.string
required
A unique, unpredictable value for this attempt. Bind it to the person’s pending connection and check it on the callback.
string
required
BASE64URL(SHA256(code_verifier)), where code_verifier is a high-entropy value you generate and keep on your server for this attempt.string
required
Always
S256. plain isn’t supported.The person signs in and consents
1Password signs the person in and shows the consent screen, which lists what your integration can and can’t do. The person accepts or declines. The consent screen appears for Individual and Family accounts. Other account types, including Business accounts, land on the 1Password home page, so don’t use your company’s Business account as a test user. The consent screen shows the name and icon from your OAuth client registration.Handle the callback
When 1Password creates a new integration key, it redirects to your callback with the code andstate in the query string and the integration_key in the fragment:
iss, the issuer, and base_url, the API origin for the person’s environment.
When the person connects again and their integration key is still active, the fragment is absent:
callback.ts
state to your backend. Validate state on the backend before you accept the result: reject a missing, mismatched, or replayed value. The code is single use and expires quickly, and it’s bound to the client, the person, their account, the scope, the redirect URI, and the PKCE challenge.
A missing integration_key is a normal result, not an error. See When you receive a key.
Exchange the code
Your backend exchanges the code directly with the token endpoint:
Authenticate with HTTP Basic only. Don’t also send
client_id in the body: the token endpoint rejects a request that uses both.
Response
user_id. Store the access token and refresh token in your backend, and never expose the client secret or the code verifier to browser code. Treat the token strings as opaque.
Refresh the access token
Access tokens expire after 15 minutes. Refresh from your backend:invalid_grant response to a refresh means the connection has ended: ask the person to connect again.
Errors
Checklist
- A Connect 1Password action in your product.
- A backend endpoint that creates
state, the code verifier, and the S256 code challenge, then starts the redirect. - An
httpscallback, registered exactly on your OAuth client. - A callback page that reads
integration_keyfrom the fragment, stores it before anything else that can fail, then clears the fragment. It keeps the key out of analytics and error reporting. - Backend handling that validates
stateand rejects missing, mismatched, or replayed values. - A backend code exchange, with the client secret and code verifier never exposed to browser code.
- Encrypted backend storage for tokens, with logs and error messages that redact secrets.
- Refresh-token rotation, and a reconnect path for connections that expire or are revoked.
- A Disconnect 1Password action. See Disconnect a user.