You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various typo fixes and copy edits
Added more definitions for public vs private clients
Added H3 subsection headers:
- OAuth Workflow
- OAuth Private Workflow - Additional Details
All scopes for the OAuth security model (defined below) apply to this
40
+
All scopes for the OAuth security model ([defined below](#o-auth)) apply to this
41
41
security model as well.
42
42
43
43
### Authentication
@@ -47,49 +47,59 @@ info:
47
47
| **HTTP Authorization Scheme** | bearer |
48
48
49
49
## OAuth
50
-
If all you need is a Personal Access Token, feel free to skip ahead to the next section.
50
+
If you only need to access the Linode API for personal uses,
51
+
we recommend that you create a [personal access token](#personal-access-token).
52
+
If you're designing an application that can authenticate with an arbitrary Linode user, then
53
+
you should use the OAuth 2.0 workflows presented in this section.
51
54
52
-
For more help on OAuth see our guide on [How to Create an OAuth App with the Linode Python API Library](https://www.linode.com/docs/platform/api/how-to-create-an-oauth-app-with-the-linode-python-api-library/#oauth-2-authentication-exchange).
55
+
For a more detailed example of an OAuth 2.0 implementation, see our guide on [How to Create an OAuth App with the Linode Python API Library](https://www.linode.com/docs/platform/api/how-to-create-an-oauth-app-with-the-linode-python-api-library/#oauth-2-authentication-exchange).
53
56
54
-
Before you begin, you need to creat an OAuth client. You can do this [with the API](https://developers.linode.com/api/v4/account-oauth-clients/#post) or [via the Cloud Manager](https://cloud.linode.com/profile/clients).
57
+
Before you implement OAuth in your application, you first need to create an OAuth client. You can do this [with the Linode API](https://developers.linode.com/api/v4/account-oauth-clients/#post) or [via the Cloud Manager](https://cloud.linode.com/profile/clients):
55
58
56
-
- For this you will pass a `label` and a `redirect_uri`.
57
-
- The return from this endpoint will give you a `client_id` and a `secret`.
58
-
- You can choose to make this `public`. The workflow below is split for public and private paths where they diverge.
59
+
- When creating the client, you'll supply a `label` and a `redirect_uri` (referred to as the Callback URL in the Cloud Manager).
60
+
- The response from this endpoint will give you a `client_id` and a `secret`.
61
+
- Clients can be public or private, and are private by default. You can choose to make the client public when it is created.
62
+
- A private client is used with applications which can securely store the client secret (that is, the secret returned to you when you first created the client). For example, an application running on a secured server that only the developer has access to would use a private OAuth client. This is also called a confidential client in some OAuth documentation.
63
+
- A public client is used with applications where the client secret is not guaranteed to be secure. For example, a native app running on a user's computer may not be able to keep the client secret safe, as a user could potentially inspect the source of the application. So, native apps or apps that run in a user's browser should use a public client.
64
+
- Public and private clients follow different workflows, as described below.
59
65
60
-
The OAuth workflow is a series of exchanges between your third-party app and Linode used
66
+
### OAuth Workflow
67
+
68
+
The OAuth workflow is a series of exchanges between your third-party app and Linode. The workflow is used
61
69
to authenticate a User before an application can start making API calls on the User's behalf.
62
70
63
71
| PRIVATE WORKFLOW | PUBLIC WORKFLOW |
64
-
|------------------|-----------------|
72
+
|------------------|------------------|
65
73
| 1. The User visits the application's website and is directed to login with Linode. | 1. The User visits the application's website and is directed to login with Linode. |
66
-
| 2. Your application then redirects the user to Linode's [authentication server](https://login.linode.com) with the client application's `client_id` and requested OAuth `scope`, which appear in the URL of the login page. | 2. Your application then redirects the user to Linode's [authentication server](https://login.linode.com) with the client application's `client_id` and requested OAuth `scope`, which appear in the URL of the login page. |
74
+
| 2. Your application then redirects the user to Linode's [authentication server](https://login.linode.com) with the client application's `client_id` and requested OAuth `scope`, which should appear in the URL of the login page. | 2. Your application then redirects the user to Linode's [authentication server](https://login.linode.com) with the client application's `client_id` and requested OAuth `scope`, which should appear in the URL of the login page. |
67
75
| 3. The user logs into the authorization server with their username and password. | 3. The user logs into the authorization server with their username and password. |
68
-
| 4. The authorization server redirects the user to the specificed redirect URL with a temporary authorization `code` (exchange code) in the URL. | 4. The authorization server redirects the user back to your applaction with an OAuth token in the URL hash. This is temporary and expires in 2 hours without a `refresh_token`. |
69
-
| 5. The application issues a POST request (*see below*) to the authentication server with the exchange code, `client_id`, and the client application's `client_secret`. In return, the server returns an OAuth token and `refresh_token`. | |
70
-
| 6. The authentication server responds to the client application with a new OAuth `access_token`. `access_token` is set to expire in 2 hours. | |
76
+
| 4. The authorization server redirects the user to the specificed redirect URL with a temporary authorization `code` (exchange code) in the URL. | 4. The authorization server redirects the user back to your application with an OAuth `access_token` embedded in the redirect URL's hash. This is temporary and expires in 2 hours without a `refresh_token`. |
77
+
| 5. The application issues a POST request (*see below*) to the authentication server with the exchange code, `client_id`, and the client application's `client_secret`. | |
78
+
| 6. The authentication server responds to the client application with a new OAuth `access_token` and `refresh_token`. The `access_token` is set to expire in 2 hours. | |
71
79
| 7. The `refresh_token` can be used to get a new OAuth `access_token`, good for another 2 hours, and a new `refresh_token`, which you can use to extend the session again by this same method, by contacting the authentication server again with the `client_id`, `client_secret`, and `refresh_token`. | |
72
80
73
-
The following is more information for the private workflow expanding on step 5 and beyond.
81
+
### OAuth Private Workflow - Additional Details
74
82
75
-
Once the User has logged into Linode and you have received an exchange code,
76
-
you will need to trade that exchange code for an Authorization token. You
77
-
do this by making an HTTP POST request to the following address:
83
+
The following information expands on steps 5 through 7 of the private workflow:
78
84
79
-
```
80
-
https://login.linode.com/oauth/token
81
-
```
85
+
Once the User has logged into Linode and you have received an exchange code,
86
+
you will need to trade that exchange code for an `access_token` and `refresh_token`. You
87
+
do this by making an HTTP POST request to the following address:
82
88
83
-
Make this request as `application/x-www-form-urlencoded` or as
84
-
`multipart/form-data` and include the following parameters in the POST body:
89
+
```
90
+
https://login.linode.com/oauth/token
91
+
```
85
92
86
-
| PARAMETER | DESCRIPTION |
87
-
|-----------|-------------|
88
-
| client_id | Your app's client ID. |
89
-
| client_secret | Your app's client secret. |
90
-
| code | The code you just received from the redirect |
93
+
Make this request as `application/x-www-form-urlencoded` or as
94
+
`multipart/form-data` and include the following parameters in the POST body:
91
95
92
-
You'll get a reponse like this:
96
+
| PARAMETER | DESCRIPTION |
97
+
|-----------|-------------|
98
+
| client_id | Your app's client ID. |
99
+
| client_secret | Your app's client secret. |
100
+
| code | The code you just received from the redirect. |
101
+
102
+
You'll get a response like this:
93
103
94
104
```json
95
105
{
@@ -100,18 +110,20 @@ info:
100
110
}
101
111
```
102
112
103
-
Included in the reponse is `access_token`. With this token, you can proceed to make
113
+
Included in the reponse is an `access_token`. With this token, you can proceed to make
104
114
authenticated HTTP requests to the API by adding this header to each request:
| **AuthorizationCode Oauth Flow** | **Authorization URL:** https://login.linode.com/oauth/authorize<br />**Token URL:** https://login.linode.com/oauth/token<br />**Scopes:**<br /><ul><li>`account:read_only` - Allows access to GET information about your Account.</li><li>`account:read_write` - Allows access to all endpoints related to your Account.</li><li>`domains:read_only` - Allows access to GET Domains on your Account.</li><li>`domains:read_write` - Allows access to all Domain endpoints.</li><li>`events:read_only` - Allows access to GET your Events.</li><li>`events:read_write` - Allows access to all endpoints related to your Events.</li><li>`images:read_only` - Allows access to GET your Images.</li><li>`images:read_write` - Allows access to all endpoints related to your Images.</li><li>`ips:read_only` - Allows access to GET your ips.</li><li>`ips:read_write` - Allows access to all endpoints related to your ips.</li><li>`linodes:read_only` - Allows access to GET Linodes on your Account.</li><li>`linodes:read_write` - Allow access to all endpoints related to your Linodes.</li><li>`lke:read_only` - Allows access to GET LKE Clusters on your Account.</li><li>`lke:read_write` - Allows access to all endpoints related to LKE Clusters on your Account.</li><li>`longview:read_only` - Allows access to GET your Longview Clients.</li><li>`longview:read_write` - Allows access to all endpoints related to your Longview Clients.</li><li>`nodebalancers:read_only` - Allows access to GET NodeBalancers on your Account.</li><li>`nodebalancers:read_write` - Allows access to all NodeBalancer endpoints.</li><li>`stackscripts:read_only` - Allows access to GET your StackScripts.</li><li>`stackscripts:read_write` - Allows access to all endpoints related to your StackScripts.</li><li>`volumes:read_only` - Allows access to GET your Volumes.</li><li>`volumes:read_write` - Allows access to all endpoints related to your Volumes.</li></ul><br />|
| **Scopes** | <ul><li>`account:read_only` - Allows access to GET information about your Account.</li><li>`account:read_write` - Allows access to all endpoints related to your Account.</li><li>`domains:read_only` - Allows access to GET Domains on your Account.</li><li>`domains:read_write` - Allows access to all Domain endpoints.</li><li>`events:read_only` - Allows access to GET your Events.</li><li>`events:read_write` - Allows access to all endpoints related to your Events.</li><li>`images:read_only` - Allows access to GET your Images.</li><li>`images:read_write` - Allows access to all endpoints related to your Images.</li><li>`ips:read_only` - Allows access to GET your ips.</li><li>`ips:read_write` - Allows access to all endpoints related to your ips.</li><li>`linodes:read_only` - Allows access to GET Linodes on your Account.</li><li>`linodes:read_write` - Allow access to all endpoints related to your Linodes.</li><li>`lke:read_only` - Allows access to GET LKE Clusters on your Account.</li><li>`lke:read_write` - Allows access to all endpoints related to LKE Clusters on your Account.</li><li>`longview:read_only` - Allows access to GET your Longview Clients.</li><li>`longview:read_write` - Allows access to all endpoints related to your Longview Clients.</li><li>`nodebalancers:read_only` - Allows access to GET NodeBalancers on your Account.</li><li>`nodebalancers:read_write` - Allows access to all NodeBalancer endpoints.</li><li>`stackscripts:read_only` - Allows access to GET your StackScripts.</li><li>`stackscripts:read_write` - Allows access to all endpoints related to your StackScripts.</li><li>`volumes:read_only` - Allows access to GET your Volumes.</li><li>`volumes:read_write` - Allows access to all endpoints related to your Volumes.</li></ul><br />|
0 commit comments