Join our Newsletter — 33% off our NHI Course
Home› Guides› OAuth Grant Types for Beginners: Three Common Ways…
Guide Authentication

OAuth Grant Types for Beginners: Three Common Ways an App Gets Access

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 12 min read
On this page

An OAuth grant type is one set route an app follows to get a pass for someone's data.

This guide is for students, people new to IT work and anyone who has seen "authorization code" or "device code" and wondered what they mean. It builds on OAuth 2.0 for Beginners. You do not need to write code. If you sign in to a smart TV, or your firm connects apps together, these routes are already in use.

In short

  • OAuth has several routes, called grant types, for an app to get an access pass. Each fits a different kind of app.
  • The authorization code route is for apps where a person signs in and agrees on a web page.
  • The client credentials route is for software that acts for itself, with no person involved.
  • The device route is for TVs and similar gadgets: you finish signing in on your phone. Two older routes are now advised against.

What you will learn

  • Explain what a grant type is in one sentence.
  • Tell the three common routes apart, with one picture for each.
  • Spot which route an app or service is using.
  • Check for the routes that experts now advise against.
Digital pass (access token)
a short code that lets an app use your data within agreed limits.
Pass desk (authorization server)
the service that checks who is asking and hands out passes.
Route (grant type)
the set of steps an app follows to get a pass.

What is an OAuth grant type?

Think of a valet key for a car. The OAuth beginner guide explains the key itself. This guide is about the different ways someone can be handed that key.

A guest at a hotel gets the valet key at the front desk, after showing ID. A company driver collects it with a staff pass, with no guest present. A guest stuck in a car park might ring the desk and read out a code instead.

OAuth works the same way. An app asks a pass desk, known as an authorization server, for a digital pass called an access token. The steps it follows are its grant type. The OAuth rules describe a grant as a credential that stands for the owner's permission.[1]

Where the comparison stops working: a valet key is the same object however you collect it. With OAuth, the route can change how safe the pass is, and how easily someone could grab it on the way.

Why does it matter?

Picking the wrong route can expose passwords or passes. Experts now advise against two of the older routes for that reason.[2]

If you sign in on a TV or games console

What could happen: a scammer may send you a code and a real-looking link, so you approve their device instead of yours.

Check this: only enter a code that is showing on a screen in front of you, right now.

Next: Device Code Phishing Guide

If you are new to IT work

What could happen: you may approve an app that asks for staff passwords directly, a route experts say must not be used.

Check this: ask which grant type each connected app uses, and flag any that collect passwords.

Next: OAuth Apps and Integrations for Beginners

If you build or run apps

What could happen: a back-end job using the client credentials route has a secret. If it leaks, anyone holding it may act as that job.

Check this: list every app secret, who owns it, and where it is stored.

Next: Machine-to-Machine OAuth (Client Credentials) Guide

What does it look like?

The device route is the one most people see. Here is a made-up TV screen.

Example only. All values are made up.

EXAMPLE TV - Sign in to ExampleStream
On your phone or computer, go to:
  example.com/device                (1)
Enter this code:
  FAKE-0000                         (2)
This code expires in 15 minutes     (3)
Waiting for you to approve...       (4)
  1. The sign-in page, opened on a second device that has a proper keyboard.
  2. A short one-time code. In a real screen, this line would show a fresh code for this TV only.
  3. The code runs out after a short time.
  4. The TV keeps asking the pass desk whether you have approved yet.

Why this is risky: whoever enters the code links their sign-in to the device showing it. A scammer can send you a code from their own device and ask you to enter it.

The safer way: only enter a code shown on a screen you are looking at. Ignore codes that arrive by email, chat or phone call.

How does it work?

Here are the three routes most people will meet. Each has its own picture.

1. Authorization code: a person signs in on a web page

  1. The app sends you to the pass desk's own sign-in page.
  2. You sign in there and agree to what the app may do.
  3. The pass desk sends the app a one-time code, through your browser.
  4. The app swaps that code, directly with the pass desk, for an access token.

The OAuth rules say the code is obtained through the pass desk acting as a go-between, so the app never sees your password.[1] An extra check called PKCE, which stands for proof key for code exchange, stops a stolen code being swapped by someone else. The app makes a secret for each sign-in and must show it when it swaps the code.[3] Current expert advice says apps on phones and in browsers must use it.[2]

Diagram titled Authorization code: a person signs in. Four boxes: You (top left), the Pass desk or authorization server (top right), the App (bottom left) and Your data (bottom right). Numbered arrows: 1, the app sends you to the pass desk; 2, you sign in and agree there, and your password stays there; 3, a dashed arrow brings a one-time code back to the app via your browser; 4, a green arrow shows the app swapping the code plus its PKCE secret for a token; 5, the app uses the token to reach only what you agreed. A green bar says your password stays with the pass desk, and a stolen code is of little use without the app's secret.
Figure 1. The authorization code route. You sign in at the pass desk, and the app gets a code it must swap for a pass.

2. Client credentials: software acting for itself

  1. A program, such as a nightly report job, has its own ID and secret.
  2. It shows them to the pass desk.
  3. The pass desk checks them and hands back an access token.
  4. No person signs in and no permission screen appears.

The OAuth rules say this route is used when the app is acting for itself.[1] That program is a non-human identity (NHI): a digital identity, and the credential behind it, that lets software act without a person. Its secret needs the same care as any other: an owner, a safe store and regular changes.

Diagram titled Client credentials: software acting for itself. Three boxes: a Program, for example a nightly report job, which holds an ID and a secret; the Pass desk (authorization server); and a Company system. Arrows: 1, the program goes to the pass desk; 2, the pass desk returns a token; 3, a curved arrow shows the program using the token on the company system. A box says no person, no permission screen. A green bar says the secret is the key: give it an owner, store it safely, change it regularly.
Figure 2. The client credentials route. No person is involved, so the program's own secret is what matters.

3. Device: finishing sign-in on a second screen

  1. A TV or similar device asks the pass desk for a short code.
  2. It shows you the code and a web address.
  3. You open the address on your phone, sign in and type the code.
  4. Meanwhile, the device keeps asking the pass desk if you have finished. Once you approve, it gets its access token.

This route was designed for internet-connected gadgets that lack a browser or a good keyboard, such as smart TVs and printers.[4]

Diagram titled Device: finish sign-in on a second screen. A dark TV box shows Go to example.com/device and Code: FAKE-0000. A dark Pass desk (authorization server) box is on the right, and a Your phone box, sign in and enter code, is below. Arrows: 1, TV asks for a code; 2, TV shows the code to you; 3, you approve on your phone; 4, a dashed arrow shows the TV repeatedly asking if you are done; 5, the token is sent to the TV. A green-edged box says only enter a code shown on a screen in front of you. A green bar says the code links your sign-in to whichever device asked for it.
Figure 3. The device route. The code ties your sign-in to the device that asked for it.

Two older routes experts advise against

  • The password route. The app collects your username and password itself. Current expert advice says it must not be used, because it exposes your password to the app.[2]
  • The implicit route. The pass was handed straight back through the browser address. Current advice says apps should not use it, because passes can leak that way.[2]

A worked example

Lars Lindahl started as an IT helper at a small architecture firm last month. His manager, Cyrus Jovanovic, asks him to list every app connected to the firm's email and file system.

Lars finds six. He checks each one's settings and help pages to see which route it uses.

Four are ordinary apps where staff click "Connect" and sign in on the provider's own page. That is the authorization code route. Lars notes that the provider's page is where the password goes.

One is the nightly backup job. It has its own ID and secret and uses the client credentials route. Lars finds the secret pasted into a shared notes file. He tells Cyrus, who moves it to the firm's password vault and asks the supplier to issue a new one. The old one is then switched off.

The last is an old timesheet tool. It asks staff to type their email password straight into the tool. Lars recognises the password route. Cyrus contacts the supplier, who has a newer version that uses the provider's sign-in page instead. They plan the switch for next week.

Lars also remembers the meeting-room TV. It was signed in with a code on someone's phone. He checks that it uses its own account with limited access, not a manager's account.

His final list has three columns: app, route and owner. Cyrus adds it to the firm's yearly review.

Myths and mistakes

What people thinkWhat is true
All OAuth sign-ins are equally safe.The route matters. Some older routes are now advised against.[2]
If an app uses OAuth, it never sees my password.That holds for the authorization code route. The old password route hands your password to the app.
Client credentials are safe because no person is involved.The program's secret is the weak point. If it leaks, someone else may get passes in the program's name.
A device code from a helpful email is fine to enter.Only enter codes shown on a screen in front of you. A code from someone else may link your sign-in to their device.
PKCE is only for phone apps.Current expert advice covers web apps too.[2]

What can I do this week?

  • Look at the apps connected to your email or work account and note which ones sent you to the provider's own sign-in page.
  • If any app asks you to type your email password into it directly, ask IT about it.
  • Next time a TV asks for a code, notice the steps. Only enter codes shown on that screen.
  • If you run apps, list every client secret and check each has an owner and a safe store.

Checklist

  • I can explain what a grant type is in one sentence.
  • I can name the three common routes and what each is for.
  • I know the authorization code route keeps my password away from the app.
  • I know client credentials depend on a secret that must be kept safe.
  • I only enter device codes shown on a screen in front of me.
  • I can spot an app using the old password route.
  • I know what PKCE adds to the authorization code route.

Common questions

Which grant type is the most common?

For apps where a person signs in, the authorization code route, usually with PKCE. It sits behind most "Sign in with" and "Connect your account" buttons. For software talking to software, the client credentials route is common. The device route appears mainly on TVs and other gadgets.

Is a grant type the same as a token?

No. The grant type is the route an app follows. The access token is the pass it gets at the end. Different routes can end with the same kind of pass. See Access and Refresh Tokens for Beginners for the passes themselves.

Why was the password route dropped?

Because it hands your password to the app. That defeats a main purpose of OAuth, and it does not work well with extra sign-in checks such as a code on your phone. Current expert advice says it must not be used.[2]

Can someone misuse the device route?

Yes. A scammer can start a device sign-in on their own machine, then send you the code with a convincing message. If you enter it, their device may get a pass to your account. Only enter codes shown on a screen you are looking at.

Do AI agents use these routes?

Often, yes. An agent acting for itself may use client credentials. An agent acting for a person may use the authorization code route, so the person signs in and agrees. Either way, the agent is a non-human identity and its passes need care.

Where next?

Ready for the detail? Read the practitioner guide: PKCE Implementation. It goes further into how the PKCE check works, the server duties in current OAuth advice, and how to test an implementation.

Also useful:

Related NHI Mgmt Group resources: Access and Refresh Tokens for Beginners · Consent Phishing for Beginners · Non-Human Identities for Beginners

Key terms

OAuth grant
The route, and the proof of permission, an app uses to get an access token.
Access token
A short-lived pass that lets an app use data within agreed limits.
Authorization server
The service that checks who is asking and hands out tokens.
Authorization code flow
The route where a person signs in at the provider and the app swaps a one-time code for a token.
Client credentials flow
The route where software uses its own ID and secret to get a token, with no person involved.
Device authorization grant
The route where a gadget shows a code and you approve it on a second device.
PKCE
An extra check that stops a stolen one-time code being swapped for a token by someone else.

Sources and further reading

  1. The OAuth 2.0 Authorization Framework (RFC 6749). Internet Engineering Task Force, October 2012. https://www.rfc-editor.org/rfc/rfc6749, accessed 28 Nov 2026.
  2. Best Current Practice for OAuth 2.0 Security (RFC 9700). Internet Engineering Task Force, January 2025. https://www.rfc-editor.org/rfc/rfc9700, accessed 28 Nov 2026.
  3. Proof Key for Code Exchange by OAuth Public Clients (RFC 7636). Internet Engineering Task Force, September 2015. https://www.rfc-editor.org/rfc/rfc7636, accessed 28 Nov 2026.
  4. OAuth 2.0 Device Authorization Grant (RFC 8628). Internet Engineering Task Force, August 2019. https://www.rfc-editor.org/rfc/rfc8628, accessed 28 Nov 2026.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.