|
2 | 2 | title:Authorizations
|
3 | 3 | ---
|
4 | 4 |
|
5 |
| -#OAuth Authorizations API |
| 5 | +{% if page.version == 'dotcom' or page.version > 2.6 %} |
6 | 6 |
|
7 |
| -{:toc} |
| 7 | +{{#tip}} |
8 | 8 |
|
9 |
| -You can use this API to manage your OAuth applications. You can only access this API via[Basic Authentication](/v3/auth#basic-authentication) using your username and password, not tokens. |
| 9 | + <aname="preview-period"></a> |
10 | 10 |
|
11 |
| -Make sure you understand how to[work with two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if you or your users have two-factor authentication enabled. |
| 11 | + APIs for managing OAuth grants are currently available for developers to preview. |
| 12 | + During the preview period, the APIs may change without advance notice. |
| 13 | + Please see the[blog post](/changes/2016-04-21-oauth-authorizations-grants-api-preview) for full details. |
| 14 | + |
| 15 | + To access the API you must provide a custom[media type](/v3/media) in the`Accept` header: |
| 16 | + |
| 17 | + application/vnd.github.damage-preview |
12 | 18 |
|
| 19 | +{{/tip}} |
| 20 | + |
| 21 | +{% endif %} |
| 22 | + |
| 23 | +<br> |
13 | 24 | <divclass="alert">
|
14 | 25 | <h3id="deprecation-notice">Deprecation Notice</h3>
|
15 | 26 |
|
@@ -51,6 +62,48 @@ Make sure you understand how to [work with two-factor authentication](/v3/auth/#
|
51 | 62 | </p>
|
52 | 63 | </div>
|
53 | 64 |
|
| 65 | +#OAuth Authorizations API |
| 66 | + |
| 67 | +{:toc} |
| 68 | + |
| 69 | +You can use this API to manage the access OAuth applications have to your account. You can only access this API via[Basic Authentication](/v3/auth#basic-authentication) using your username and password, not tokens. |
| 70 | + |
| 71 | +Make sure you understand how to[work with two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if you or your users have two-factor authentication enabled. |
| 72 | + |
| 73 | +{% if page.version == 'dotcom' or page.version > 2.6 %} |
| 74 | + |
| 75 | +##List your grants |
| 76 | + |
| 77 | +You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the[list your authorizations](/v3/oauth_authorizations/#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on[the application authorizations settings screen within GitHub][authorized-application-listing]. The`scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with`repo` scope and another token with`user` scope, the grant will return`["repo", "user"]`. |
| 78 | + |
| 79 | +GET /applications/grants |
| 80 | + |
| 81 | +###Response |
| 82 | + |
| 83 | +<%= headers 200,:pagination => default_pagination_rels %> |
| 84 | +<%= json(:oauth_authorization) { |h|[h] } %> |
| 85 | + |
| 86 | +##Get a single grant |
| 87 | + |
| 88 | +GET /applications/grants/:id |
| 89 | + |
| 90 | +###Response |
| 91 | + |
| 92 | +<%= headers 200 %> |
| 93 | +<%= json(:oauth_authorization) %> |
| 94 | + |
| 95 | +##Delete a grant |
| 96 | + |
| 97 | +Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on[the application authorizations settings screen within GitHub][authorized-application-listing]. |
| 98 | + |
| 99 | +DELETE /applications/grants/:id |
| 100 | + |
| 101 | +###Response |
| 102 | + |
| 103 | +<%= headers 204 %> |
| 104 | + |
| 105 | +{% endif %} |
| 106 | + |
54 | 107 | ##List your authorizations
|
55 | 108 |
|
56 | 109 | GET /authorizations
|
@@ -267,4 +320,5 @@ links that might be of help:
|
267 | 320 |
|
268 | 321 | [app-listing]:https://github.com/settings/developers
|
269 | 322 | [tokens-listing]:https://github.com/settings/tokens
|
| 323 | +[authorized-application-listing]:https://github.com/settings/applications#authorized |
270 | 324 | [basics auth guide]:/guides/basics-of-authentication/
|