You are here

public function OAuth2ClientInterface::getAccessToken in OAuth2 Client 8

Get and return an access token.

If there is an existing token (stored in session), return that one. But if the existing token is expired, get a new one from the authorization server.

If the refresh_token has also expired and the auth_flow is 'server-side', a redirection to the oauth2 server will be made, in order to re-authenticate. However the redirection will be skipped if the parameter $redirect is FALSE, and NULL will be returned as access_token.

1 method overrides OAuth2ClientInterface::getAccessToken()
OAuth2Client::getAccessToken in src/Service/OAuth2Client.php

File

src/Service/OAuth2ClientInterface.php, line 40

Class

OAuth2ClientInterface
Interface OAuth2ClientInterface.

Namespace

Drupal\oauth2_client\Service

Code

public function getAccessToken($redirect = TRUE);