ozvault home

OZVAULT CONNECT · OAUTH 2.0

OAuth 2.0 authorization code flow

Send users to OzVault's authorization endpoint with PKCE and state, handle consent, and receive an authorization code at your registered callback.

Reviewed Published by OzVault

The flow at a glance

#

1. Your app creates state and a PKCE code verifier, stores them in the user's session, and redirects to /oauth/authorize. 2. OzVault signs the user in if needed (new users receive the standard free 15 GB account). 3. The user sees your logo, name, publisher, website, the requested permissions and where they will be returned. 4. On Authorize, OzVault redirects to your redirect_uri with code, state and iss. 5. Your server exchanges the code within two minutes. 6. Your server calls the API with the access token.

No application receives anything merely by redirecting a user: nothing is issued until the user chooses Authorize, and codes are useless without your PKCE verifier.

Build the authorization request

#

Every parameter except nonce and prompt is required. state must be 1-1024 printable ASCII characters; generate it randomly per request. code_challenge_method must be S256. Repeating a parameter is an error.

Authorization parameters
ParameterValue
response_typecode
client_idYour client ID
redirect_uriOne of your registered redirect URLs, exactly
scopeSpace-separated scopes enabled for your application
stateRandom value you verify on return (CSRF protection)
code_challengeBASE64URL(SHA-256(code_verifier)), 43 characters
code_challenge_methodS256 (plain is not accepted)
nonceOptional; echoed in the id_token when openid is requested
promptOptional: none, login, consent, or login consent
TypeScript
GET https://ozvault.lol/oauth/authorize
  ?response_type=code
  &client_id=ovc_YOUR_CLIENT_ID
  &redirect_uri=https%3A%2F%2Fexample.com%2Fauth%2Fozvault%2Fcallback
  &scope=profile%3Aread%20storage%3Aapp%3Aread%20storage%3Aapp%3Awrite%20offline_access
  &state=Wm9wcVZ0Yk1yQ2hLZ0Rz
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256

Handle the callback

#

On success the user arrives at your redirect URL with code, state and iss (RFC 9207). Compare state with the value you stored for this browser session, and check that iss equals the OzVault issuer, before exchanging the code. If the user cancels or the request is invalid, you receive error and error_description instead; nothing was shared.

Success
https://example.com/auth/ozvault/callback?code=Qe3...&state=Wm9wcVZ0Yk1yQ2hLZ0Rz&iss=https%3A%2F%2Fozvault.lol
Declined
https://example.com/auth/ozvault/callback?error=access_denied&error_description=The+user+declined+to+authorize+this+application&state=Wm9wcVZ0Yk1yQ2hLZ0Rz&iss=https%3A%2F%2Fozvault.lol

Returning users and prompt

#

If the user already granted every requested scope to your app, OzVault skips the screen and redirects immediately with a new code. Requesting a new scope shows the screen again with the new permission marked. prompt=consent always shows the screen; prompt=login requires a fresh sign-in; prompt=none never shows UI and returns login_required or consent_required when interaction would be needed.

Authorization errors

#

Errors about the client or redirect URL are shown on OzVault and never redirected, so a forged link cannot bounce users to an attacker. Other problems are returned to your registered redirect URL.

Errors returned to the redirect URL
errorMeaning
access_deniedThe user chose Cancel
invalid_requestMissing or repeated parameter, missing state, or PKCE not S256
invalid_scopeUnknown scope, or one not enabled for your application
unsupported_response_typeresponse_type was not code
login_required / consent_requiredprompt=none could not complete without the user

Clear documentation is part of the product.