Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5cf0e1

Browse files
committed
document oauth authorizations api
1 parentd67eb58 commita5cf0e1

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

‎content/v3/oauth.md‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,81 @@ can specify multiple scopes by separating them by a comma.
129129
client_id=...&
130130
scope=user,public_repo
131131

132+
##OAuth Authorizations API
133+
134+
There is an API for users to manage their own tokens. You can only
135+
access your own tokens, and only through Basic Authentication.
136+
137+
##List your authorizations
138+
139+
GET /authorizations
140+
141+
###Response
142+
143+
<%= headers 200,:pagination => true %>
144+
<%= json(:oauth_access) { |h|[h] } %>
145+
146+
##Get a single authorization
147+
148+
GET /authorizations/:id
149+
150+
###Response
151+
152+
<%= headers 200 %>
153+
<%= json:oauth_access %>
154+
155+
##Create a new authorization
156+
157+
Note: Authorizations created from the API will show up in the GitHub API
158+
app.
159+
160+
POST /authorizations
161+
162+
###Input
163+
164+
scopes
165+
:_Optional_**array** - A list of scopes that this authorization is in.
166+
167+
<%= json:scopes =>["public_repo"] %>
168+
169+
###Response
170+
171+
<%= headers 201,:Location => "https://api.github.com/authorizations/1"
172+
%>
173+
<%= json:oauth_access %>
174+
175+
##Update an existing authorization
176+
177+
PATCH /authorizations/1
178+
179+
###Input
180+
181+
scopes
182+
:_Optional_**array** - Replaces the authorization' scopes with these.
183+
184+
add_scopes
185+
:_Optional_**array** - A list of scopes to add to this authorization.
186+
187+
remove_scopes
188+
:_Optional_**array** - A list of scopes to remove from this
189+
authorizatin.
190+
191+
You can only send one of these scope keys at a time.
192+
193+
<%= json:add_scopes =>['repo'] %>
194+
195+
###Response
196+
197+
<%= headers 200 %>
198+
<%= json:oauth_access %>
199+
200+
##Delete an authorization
201+
202+
DELETE /authorizations/1
203+
204+
###Response
205+
206+
<%= headers 204 %>
132207

133208
##More Information
134209

‎lib/resources.rb‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,19 @@ def json(key)
661661
"id"=>1
662662
}
663663

664+
OAUTH_ACCESS={
665+
"id"=>1,
666+
"url"=>"https://api.github.com/authorizations/1",
667+
"scopes"=>["public_repo"],
668+
"token"=>"abc123",
669+
"app"=>{
670+
"url"=>"http://my-github-app.com",
671+
"name"=>"my github app"
672+
},
673+
"updated_at"=>"2011-09-06T20:39:23Z",
674+
"created_at"=>"2011-09-06T17:26:27Z"
675+
}
676+
664677
end
665678
end
666679

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp