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 password grant

The password grant let an application trade a person's username and password for tokens at the token endpoint. OAuth 2.0 included it as a step away from applications that stored passwords, and current guidance forbids it because it keeps the problem OAuth set out to remove.

A token for a password

The first version of photos-cli, the photo service's own command-line tool, began every session the same way. It asked Ava for her photo account's username and password, right there in the terminal, traded them for tokens, and, to its credit, never saved the password.

That trade was the resource owner password credentials grant, usually called the password grant. It was part of OAuth 2.0 from the start, and current security guidance says it must not be used.

All values in these examples are fictional, including the password. The tool sent what Ava typed straight to the token endpoint:

POST /token HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded

grant_type=password
&username=ava%40photos.example
&password=demo-password-not-real
&scope=photos.read
&client_id=photos-cli

There is no browser, no redirect, no code, and no approval screen. The authorization server checked the password with its normal sign-in logic and, if it was right, returned an ordinary token response, often with a refresh token so the tool would not need the password again. A confidential client would also have authenticated itself in the same request. photos-cli, installed on many people's computers, was a public client and sent only its client ID.

Why it was included

When OAuth 2.0 was written, plenty of applications already held users' passwords. Desktop mail programs, phone apps, and scripts signed in to APIs with HTTP Basic authentication, the encoded username and password from Public and confidential clients, or its Digest variant, which sends a hash computed from the password instead. Either way they sent proof of the password with every request and stored the password so they could. RFC 6749 offered the password grant as a step away from that: exchange the password once for a token, then forget it.

The specification hedged it heavily. It described the grant as suitable only where the person had a high degree of trust in the client, such as the device's operating system or a highly privileged application, and only when other grants were not available. In practice, many services also used it for their own applications, where the tool and the authorization server belonged to the same organization. If photos-cli is the photo service's own tool, why send Ava through a browser to type the same password into the same company's page?

What it costs

The answer is that the password grant keeps the very problem OAuth was created to remove. The client sees Ava's password. Even a well-behaved client can leak it through a crash report, a debug log, or a compromised computer, and a less honest one can simply keep it. The authorization server cannot tell whether the request came from Ava or from a script trying stolen passwords, which is why RFC 6749 itself required the endpoint to be protected against brute-force attempts.

It also freezes sign-in at a username and a password. The client knows how to collect two fields and nothing else. If the photo service adds a second factor, offers passkeys, or lets business accounts sign in through their company's identity provider, the password grant cannot take part, because none of those steps fits into a form that the client posts. Passkeys and similar credentials are usually bound to the authorization server's own web origin, so a form inside another application often cannot use them at all. Services that kept the grant often found it was the one sign-in path their stronger protections did not reach.

Ava loses her part in the decision, too. There is no approval screen, so nothing shows her which application is asking or what it will be able to do; the client chooses the scope. And every legitimate application that asks for a photo service password teaches people that typing it into other applications is normal, which is exactly the habit a phishing page relies on.

photos-cli posts her password

Who sees the password
photos-cli
Second factor or passkey
No place for it
Approval screen
None
Ava or a script?
Server cannot tell

Must not be used

photos-cli opens the browser

Who sees the password
The photo service's own page
Second factor or passkey
Asked on that page
Approval screen
Shows which application asks
Ava or a script?
Ava signs in herself

The tool never sees the password

The same tool, two ways to sign Ava in. Only the browser flow keeps her password on the photo service's own page, where a second step or a passkey can be asked for.

Current guidance

The OAuth 2.0 Security Best Current Practice, RFC 9700, is direct: the password grant MUST NOT be used. It names the exposure of the person's credentials to the client, the habit it teaches, and its incompatibility with multi-step and cryptographic authentication. OAuth 2.1, the working group's consolidation of OAuth 2.0, leaves the grant out as well.

The replacements depend on the client. An installed application, whether it belongs to the photo service or to someone else, opens the system browser for the authorization code flow with PKCE, as Native applications described. A command-line tool like photos-cli can do the same with a loopback redirect, or use the device authorization grant when it runs where no browser is available, as Command-line tools compared. Either way, the password is typed only on the photo service's own page, which can ask for whatever else the account requires.

The most common reason the grant survives today is automated testing, because a script can sign in a test user without driving a browser. Tests have better options, such as a test authorization server that issues tokens for test accounts, or client credentials when the test concerns a service rather than a person. A grant left enabled for tests tends to stay enabled for everything else as well.

Check your understanding

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

The photo service adds passkeys, but Ava's old photos-cli, which uses the password grant, still cannot sign her in with one. Why not? 1 of 2

Choose one answer.

A developer argues that photos-cli belongs to the photo service itself, so it can keep using the password grant. What does current security guidance say? 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