Skip to content

Commit 57a3308

Browse files
committed
fix 2fa section regarding sms-based 2fa
1 parent ca5e4c5 commit 57a3308

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

content/guides/getting-started.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ X-GitHub-OTP: required; :2fa-type
135135
}
136136
</pre>
137137

138-
To get around that error, provide your 2FA OTP code in the [X-GitHub-OTP request header][2fa header]:
138+
If you enabled 2FA with a mobile application, you can get around that error
139+
by providing an 2FA OTP code in the [X-GitHub-OTP request header][2fa header]:
139140

140141
<pre class="terminal">
141142
$ curl -i -u &lt;your_username&gt; -H "X-GitHub-OTP: &lt;your_2fa_OTP_code&gt;" \
@@ -154,14 +155,13 @@ HTTP/1.1 200 OK
154155
}
155156
</pre>
156157

157-
If you enabled 2FA with a mobile application, then you can get an OTP
158-
code from that application on your phone. If you enabled 2FA with text messages,
159-
then you'll get an SMS with your OTP code after making a request to an API
160-
endpoint which requires such an OTP code.
158+
To get an OTP code, use the one-time password application on your phone.
159+
However, because these OTP codes expire quickly, an easier workaround is to
160+
create and use a Personal token for authentication. See the
161+
[OAuth section][oauth section] below for more information.
161162

162-
Because these OTP codes expire quickly, an easier workaround is to create and
163-
use a Personal token for authentication. See the [OAuth section][oauth section]
164-
below for more information.
163+
If you enabled 2FA with text messages (SMS), you'll need to create an OAuth
164+
token and use [OAuth authentication][oauth section] instead of Basic Authentication.
165165

166166
### Get your own user profile
167167

@@ -260,6 +260,14 @@ in order to not frighten users with potentially invasive actions. The `201`
260260
status code tells us that the call was successful, and the JSON returned
261261
contains the details of our new OAuth token.
262262

263+
Again, if you enabled [two-factor authentication][2fa] enabled, the API will
264+
return the [previously described `401 Unauthorized` error code][2fa section]
265+
for the above request. You can get around that error by providing an OTP code
266+
in the [X-GitHub-OTP request header][2fa header], [as described above][2fa section].
267+
If you enabled 2FA with a mobile application, go ahead and get an OTP code from your
268+
one-time password application on your phone. If you enabled 2FA with text messages,
269+
you'll receive an SMS with your OTP code after making a request to this endpoint.
270+
263271
Now, we can use the forty character `token` instead of a username and password
264272
in the rest of our examples. Let's grab our own user info again, using OAuth this time:
265273

@@ -558,3 +566,4 @@ Keep learning with the next API guide [Basics of Authentication][auth guide]!
558566
[get issues api]: /v3/issues/#list-issues
559567
[repo issues api]: /v3/issues/#list-issues-for-a-repository
560568
[etag]: http://en.wikipedia.org/wiki/HTTP_ETag
569+
[2fa section]: /guides/getting-started/#two-factor-authentication

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy