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
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commit977e55c

Browse files
committed
Only request scopes which are used
1 parent2c8ec14 commit977e55c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

‎content/guides/getting-started.md‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ Also, the [**Authorizations API**][authorizations api] makes it simple to use Ba
196196
to create an OAuth token. Try pasting and running the following command:
197197

198198
<preclass="terminal">
199-
$ curl -i -u&lt;your_username&gt; -d '{"scopes": ["repo", "public_repo", "user", "gist"], \
200-
"note": "getting-started"}' https://api.github.com/authorizations
199+
$ curl -i -u&lt;your_username&gt; -d '{"scopes": ["repo", "user"], "note": "getting-started"}' \
200+
https://api.github.com/authorizations
201201

202202
HTTP/1.1 201 Created
203203
Location: https://api.github.com/authorizations/2
@@ -206,9 +206,7 @@ Content-Length: 384
206206
{
207207
"scopes": [
208208
"repo",
209-
"public_repo",
210-
"user",
211-
"gist"
209+
"user"
212210
],
213211
"token": "5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4",
214212
"updated_at": "2012-11-14T14:04:24Z",
@@ -233,9 +231,9 @@ Next, let's look at the `scopes` we're sending over in this call. When creating
233231
a new token, we include an optional array of[_scopes_][scopes], or access
234232
levels, that indicate what information this token can access. In this case,
235233
we're setting up the token with_repo_ access, which grants access to read and
236-
write to private repositories,_public\_repo_ grants access to read and write to
237-
public repositories,_user_ grantsaccess toread andwrite to alluser data, and
238-
_gist_ grants access to create new gists. See[the scopes docs][scopes] for a full list of
234+
write topublic andprivate repositories,and_user_ scope, which grants read
235+
and writeaccess topublic andprivateuserprofiledata. See
236+
[the scopes docs][scopes] for a full list of
239237
scopes. You should**only** request scopes that your application actually needs,
240238
in order to not frighten users with potentially invasive actions. The`201`
241239
status code tells us that the call was successful, and the JSON returned
@@ -248,8 +246,8 @@ in the [X-GitHub-OTP request header][2fa header]:
248246

249247
<preclass="terminal">
250248
$ curl -i -u&lt;your_username&gt; -H "X-GitHub-OTP:&lt;your_2fa_OTP_code&gt;" \
251-
-d '{"scopes": ["repo", "public_repo", "user", "gist"], \
252-
"note": "getting-started"}'https://api.github.com/authorizations
249+
-d '{"scopes": ["repo", "user"], "note": "getting-started"}' \
250+
https://api.github.com/authorizations
253251
</pre>
254252

255253
If you enabled 2FA with a mobile application, go ahead and get an OTP code from

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp