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
Copy file name to clipboardExpand all lines: openapi.yaml
+33-22Lines changed: 33 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -47,34 +47,45 @@ 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
51
51
-
The OAuth workflow is a three-step process to authenticate a User before an
52
-
application can start making API calls on the User's behalf. If all you need
53
-
is a Personal Access Token, feel free to skip ahead to the next section.
52
+
For more help on OAuth see our guide on [How to Create an OAuth App with teh 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).
54
53
55
-
1. The User visits the application's website and is directed to log in with
56
-
Linode.
57
-
1. The User is then redirected to Linode's authentication server and presented with
58
-
the scope levels the application is requesting.
59
-
1. Once the User accepts the request for access, we redirect them back to the application's
60
-
specified redirect URI with an access code.
54
+
Before you begin, you need to [Create an OAuth Client](https://developers.linode.com/api/v4/account-oauth-clients/#post).
61
55
62
-
Once the User has logged into Linode and you have received an exchange code,
63
-
you will need to trade that exchange code for an Authorization token. You
64
-
do this by making an HTTP POST request to the following address:
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.
65
59
66
-
```
67
-
https://login.linode.com/oauth/token
68
-
```
60
+
The OAuth workflow is a series of exchanges between your third-party app and Linode used
61
+
to authenticate a User before an application can start making API calls on the User's behalf.
62
+
63
+
| PRIVATE WORKFLOW | PUBLIC WORKFLOW |
64
+
|------------------|-----------------|
65
+
| 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. |
67
+
| 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 if not refreshed. | |
71
+
| 7. The refresh token can be used to get a new OAuth `access_token` for another 2 hours by contacting the authentication server again with the `client_id`, `client_secret`, and `refresh_token`. | |
72
+
73
+
Once the User has logged into Linode and you have received an exchange code,
74
+
you will need to trade that exchange code for an Authorization token. You
75
+
do this by making an HTTP POST request to the following address:
76
+
77
+
```
78
+
https://login.linode.com/oauth/token
79
+
```
69
80
70
-
Make this request as `application/x-www-form-urlencoded` or as
71
-
`multipart/form-data` and include the following parameters in the POST body:
81
+
Make this request as `application/x-www-form-urlencoded` or as
82
+
`multipart/form-data` and include the following parameters in the POST body:
72
83
73
-
| PARAMETER | DESCRIPTION | FIND OR UPDATE THIS INFORMATION |
| client_id | Your app's client ID. | [List your OAuth Clients](https://developers.linode.com/api/v4/account-oauth-clients). |
76
-
| client_secret | Your app's client secret. | [View your OAuth Client](https://developers.linode.com/api/v4/account-oauth-clients-client-id). [Reset Your OAuth Client Secret](https://developers.linode.com/api/v4/account-oauth-clients-client-id-reset-secret/#post). |
77
-
| code | The code you just received from the redirect | [View your OAuth Client](https://developers.linode.com/api/v4/account-oauth-clients-client-id). [Reset Your OAuth Client Secret](https://developers.linode.com/api/v4/account-oauth-clients-client-id-reset-secret/#post). |
84
+
| PARAMETER | DESCRIPTION | FIND OR UPDATE THIS INFORMATION |
| client_id | Your app's client ID. | [List your OAuth Clients](https://developers.linode.com/api/v4/account-oauth-clients). |
87
+
| client_secret | Your app's client secret. | [View your OAuth Client](https://developers.linode.com/api/v4/account-oauth-clients-client-id). [Reset Your OAuth Client Secret](https://developers.linode.com/api/v4/account-oauth-clients-client-id-reset-secret/#post). |
88
+
| code | The code you just received from the redirect | [View your OAuth Client](https://developers.linode.com/api/v4/account-oauth-clients-client-id). [Reset Your OAuth Client Secret](https://developers.linode.com/api/v4/account-oauth-clients-client-id-reset-secret/#post). |
0 commit comments