Skip to content

Commit 192a0a2

Browse files
committed
Merge pull request github#346 from github/curl-examples
Templetize cURL examples that use usernames and tokens for authentication
2 parents cda3840 + 0555633 commit 192a0a2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

content/v3/auth.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,23 @@ To use Basic Authentication with the GitHub API, simply send the username and
3030
password associated with the account.
3131

3232
For example, if you're accessing the API via [cURL][curl], the following command
33-
would authenticate with `mojombo` as the username. (cURL will prompt you to
34-
enter the password.)
33+
would authenticate you if you replace `<username>` with your GitHub username.
34+
(cURL will prompt you to enter the password.)
3535

3636
<pre class='terminal'>
37-
curl -u mojombo https://api.github.com/user
37+
curl -u <username> https://api.github.com/user
3838
</pre>
3939

4040
### Via OAuth Tokens
4141

4242
Alternatively, you can authenticate using [personal access
4343
tokens][personal-access-tokens] or OAuth tokens. To do so, provide the token as
44-
the username and provide a blank password or a password of `x-oauth-basic`. For
45-
example:
44+
the username and provide a blank password or a password of `x-oauth-basic`. If
45+
you're accessing the API via cURL, replace `<token>` with your OAuth token in
46+
the following command:
4647

4748
<pre class='terminal'>
48-
curl -u 3816d821c80a6847ca84550052c1ff6246e8169b:x-oauth-basic https://api.github.com/user
49+
curl -u <token>:x-oauth-basic https://api.github.com/user
4950
</pre>
5051

5152
This approach is useful if your tools only support Basic Authentication but you

0 commit comments

Comments
 (0)