Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Mar 9, 2024
1 parent 3903664 commit b20cee1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pages/oauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Using GitHub as an example, the first step is to create a GET endpoint (login en
```
https://github.com/login/oauth/authorize?
response_type=code
&client_id=<CLIENT_ID>
&redirect_uri=<CALLBACK_ENDPOINT>
&state=<STATE>
&client_id=CLIENT_ID
&redirect_uri=CALLBACK_ENDPOINT
&state=STATE
```

The state is used to ensure the user initiating the process and the one that's redirected back (in the next section) are the same user. As such, a new state must be generated on each request. While it is not strictly required by the spec, it is highly recommended and may be required depending on the provider. It should be generated using a cryptographically-secure random generator and have at least 112 bits of entropy. State can also be used to pass data from the login endpoint to the callback endpoint, though a cookie can just be used instead.
Expand Down Expand Up @@ -67,10 +67,10 @@ If you added a state to the authorization URL, the redirect request will include

The code is sent to the OAuth provider's token endpoint via an `application/x-www-form-urlencoded` POST request.

```
```none
POST https://github.com/login/oauth/access_token
Accept: application/json
Authorization: Basic <CREDENTIALS>
Authorization: Basic CREDENTIALS
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
Expand Down

0 comments on commit b20cee1

Please sign in to comment.