Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

The authorization request

When Ava selects Connect, the printer's first message is a URL: an authorization request that names the printer, the access it wants and where the answer should go. Every part of it is visible in Ava's browser, so it holds only public values and two protections for this one attempt.

Describing the request

Selecting Connect does not immediately give the printer access to Ava's photos. The request travels through Ava's browser to the authorization endpoint, as a redirect to a URL whose query carries the parameters. Here is the request used in our example, with its parameters on separate lines so we can read them:

https://auth.photos.example/authorize
  ?response_type=code
  &client_id=photo-printer
  &redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
  &scope=photos.read
  &state=demo-attempt-7
  &code_challenge=qd-75t-gnweZAhIl6REjxxgFnPXGwvqYcxq3vlsaJYQ
  &code_challenge_method=S256

This is a fictional example, not a working connection. In particular, demo-attempt-7 is a readable stand-in for an unpredictable value generated for one attempt.

response_type=code asks the authorization server to return an authorization code if the request succeeds. It does not ask the server to put an access token in the return URL.

client_id identifies the printer's registration. It is visible in the request and is not a secret, as Public and confidential clients explained. Another application knowing this value does not thereby become an authenticated instance of the printer.

redirect_uri tells the authorization server where to return the browser. The value is percent-encoded because it appears inside another URL, the encoding from Encoding and hashing: %3A is a colon and %2F a slash. Decoding it gives the printer's registered callback address.

scope describes the requested access. Here, photos.read is a permission name invented for our photo service, as in Grants, scopes, and consent. OAuth does not define that particular name. If the service used different permission names, the printer would need to request those instead. Several scopes are separated by spaces, and a space in a URL is encoded as %20, so a request for two scopes reads scope=photos.read%20photos.write.

The last three parameters protect this one attempt. state is the random value the printer keeps in its pending transaction and expects to see again in the response, so it can connect the returning answer to the attempt it started. code_challenge comes from PKCE: the printer makes a fresh secret verifier, keeps it, and sends only a value derived from it. code_challenge_method=S256 says how the challenge was derived: it is the SHA-256 hash of the verifier, base64url-encoded. A hash cannot be turned back into its input, so the challenge can travel in plain view while the verifier stays secret. Proof Key for Code Exchange (PKCE) and Correlating requests and responses follow each protection through the rest of the flow.

These fields travel through the browser. They describe the requested connection; they do not prove that access has been granted. The client secret and PKCE verifier stay on the printer backend.

Requesting is not receiving

The printer chooses what to request. The photo service controls what it will allow. The requested scope must make sense for the service and the client registration, and the resulting access may be narrower than requested or refused entirely.

For the photo book, read access is enough. Requesting deletion access merely because it is available would make the connection more powerful without helping Ava complete this task.

The URL should contain only what belongs in this browser-facing request. The printer's client secret and PKCE verifier stay on its backend. The photo service handles Ava's authentication through its own interaction; the printer does not add her photo account password to this request.

When the photo service refuses a request, where it says so depends on how far its checks got. It checks the client ID and the redirect URI first. If either is unknown or does not match the registration, the server cannot trust the return address, so it shows its own error page in the browser and sends nothing back. Once both check out, it can safely return a refusal to the printer's callback instead of a code: an error parameter such as invalid_scope for a scope the registration does not allow, unsupported_response_type for a response type it does not offer, or invalid_request for a malformed parameter, together with the state the printer sent.

A request that passes every check is still only a request. The photo service now has to establish who is at the browser and whether to allow the access, which may mean a sign-in and a consent screen. The authorization endpoint is therefore a place to request and arrange access. Receiving a valid request there is the beginning of a decision, not evidence that the decision has already been made.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The printer uses the authorization code flow with PKCE. It sends Ava's browser to the photo service's authorization endpoint to request access to her photos. Which value belongs in that authorization URL? 1 of 3

Choose one answer.

The printer requests photos.read photos.delete. What can it conclude from sending that request? 2 of 3

Choose one answer.

A typo leaves the printer's authorization request with a client_id the photo service has never registered. Where does Ava see the refusal? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity