Which grant you use depends on your execution environment. There are two kinds of environments:
- Public clients
- Confidential clients
Public Clients
Public clients run on a user’s device. They cannot keep secrets because people can find a way to view the source of the application. If you keep secrets in these clients, people can steal these secrets and do a lot of damage.
There are two common types of public clients:
- Native applications (Android, iOS, MacOS, Windows apps, etc)
- Browsers
If your application is a public client, you can use these two grant types (assuming the API supports them):
- PKCE
- Refresh Token Grant
Confidential Clients
Confidential clients are the opposite of public clients. They run on a server that users cannot access. Servers can keep secrets since there’s no way for users to view source and steal the information.
If your application is a confidential client, you can use all five grant types:
- Authorisation Code Grant
- PKCE
- Refresh Token Grant
- Client Credentials Grant
- Device Code Grant
It’s best to use Confidential Clients over Public clients for OAuth since there’s less room for complications.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson