Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/oauth-web.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ After completing the OAuth 2.0 flow, you should be redirected to `http://localho

After the web server receives the authorization code, it can exchange the authorization code for an access token.

To exchange an authorization code for an access token, use the `authenticate` method:
To exchange an authorization code for an access token, use the `fetchAccessTokenWithAuthCode` method:

```php
$client->authenticate($_GET['code']);
$client->fetchAccessTokenWithAuthCode($_GET['code']);
```

You can retrieve the access token with the `getAccessToken` method:
Expand Down Expand Up @@ -361,7 +361,7 @@ if (! isset($_GET['code'])) {
$auth_url = $client->createAuthUrl();
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
} else {
$client->authenticate($_GET['code']);
$client->fetchAccessTokenWithAuthCode($_GET['code']);
$_SESSION['access_token'] = $client->getAccessToken();
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
Expand Down
Loading