Beta

Create a tenant

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

Giving another application limited access

Sometimes you want one application to work with your data in another without handing over your password. OAuth lets you give it limited access of its own instead.

Sharing access without a password

Ava wants a printing application to make a book from her photos. The printer needs to read some of her photos from the photo service. It does not need Ava's password, and it should not be able to do everything Ava can do.

If Ava gave the printer her password, it could sign in as her and do anything she can. The only way to take that back would be to change the password she uses herself. OAuth is a standard way to give the printer its own access instead, limited to the job it is there to do.

Ava gives the printer her password

The printer can
Sign in as her and do anything she can
Ava's password
Handed to the printer
Taking it back
Change the password she uses herself

More access than the job needs

The printer gets access of its own

The printer can
Read her photos
Ava's password
The printer never sees it
Taking it back
Ava disconnects the printer

Limited to the job it is there to do

OAuth lets Ava delegate access without handing her password to the printer.

The participants

OAuth gives each part of this arrangement a name:

  • Resource owner: Ava, who can authorize access to her photos.
  • Client: the printing application requesting access.
  • Authorization server: the service that handles authorization and issues tokens under its policy.
  • Resource server: the part of the photo service that holds the photos and checks each request for them.

The word client can be confusing. It means the application asking for access, here the printer, even if its code runs on a server. The authorization server and the photo API are often run by the same company, but they do different jobs: one hands out access, the other checks it.

Ava

Its job
Can authorize access to her photos
Holds
Her password

Printing application

Its job
Requesting access
Holds
Access of its own, separate from her password

Authorization server

Its job
Issues tokens under its policy
Holds
The policy for handing out access

Photo API

Its job
Checks each request for them
Holds
The photos

The authorization server and the photo API are often run by the same company, but they do different jobs: one hands out access, the other checks it.

Keep the service that grants a token distinct from the API that accepts it.

Following the permission

Ava chooses to connect her photos in the printer, and the printer sends her browser to the authorization server. She signs in there, on the photo service's own page, so the printer never sees her password.

The authorization server then shows Ava what the printer is asking for, such as permission to read her photos. Agreeing to that request is called consent.

Once Ava agrees, the authorization server issues the printer an access token, the kind of token from How applications communicate that lets a program call an API. The printer now holds access of its own, separate from Ava's password.

Conceptual flow. The photo account password stays out of the printing app.
Optional detail: how the token reaches the printer

The access token usually doesn't travel through Ava's browser. The browser carries a short-lived authorization code back to the printer instead, and the printer trades that code for the access token in a direct request to the authorization server, on the back channel.

Using limited access

The printer sends the access token with each request to the photo API. The access Ava approved is described by a scope, such as photos.read for reading photos.

A scope names a kind of access, not a list of albums. photos.read doesn't let the printer read everyone's photos, so the photo API still checks each request: is this an album Ava can share?

The access token is a bearer token, so it needs protecting: anyone who copies it may be able to use it. It also expires. For a connection that lasts, the authorization server may give the printer a refresh token as well, which the printer uses only at the authorization server to get new access tokens without asking Ava again. It is never sent to the photo API.

When Ava disconnects the printer, the service has to change what it accepts, not just what her screen shows. The refresh token should stop working, and the printer's access tokens are refused once they are revoked or expire.

photos.readA scope names a kind of access, not a list of albums.

Read the selected album

  • Operation within photos.read
  • An album Ava can share

Read allowed within the granted access.

Read another album

  • Operation within photos.read
  • An album Ava can share

Refuse when outside the enforced resource restriction.

Delete a photo in the selected album

  • Operation within photos.read
  • An album Ava can share

Refuse: photos.read is for reading photos.

The API must enforce both the permitted operation and the permitted resource.

Connecting OAuth and OpenID Connect

The printer can now read Ava's photos. But OAuth on its own doesn't tell the printer, in a standard way, which account just signed in.

OpenID Connect, or OIDC, the federation standard from Trust across systems, adds that. Alongside the access token, the client can receive an ID token describing Ava's sign-in. The ID token is for the printer itself, and the access token is for the photo API. They have different recipients and jobs, so the two tokens are not interchangeable.

Access token

Defined by
OAuth
For
The photo API
Its job
Lets a program call an API

Doesn't tell the printer which account just signed in

ID token

Defined by
OpenID Connect, on top of OAuth
For
The printer itself
Its job
Describing Ava's sign-in

Standardized authentication

They have different recipients and jobs, so the two tokens are not interchangeable.

OpenID Connect adds standardized authentication on top of OAuth.

Check your understanding

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

Ava approves photos.read for a printer, intending to share one album. What must enforce the one-album restriction? 1 of 2

Choose one answer.

The printer receives both an ID token and an access token. Which belongs on its request to the protected photo API? 2 of 2

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