AuthorizationCodeGrant
trait AuthorizationCodeGrant
Traits
Properties
| protected OAuthConfig|null | $oauthConfig | The immutable OAuth 2 configuration. |
from HasOAuthConfig |
Methods
Parse the access token, expiry and data of a token response.
Resolve the scopes reported by the provider.
Resolve an OAuth token expiry.
Authenticate a connected account and renew its stored credentials when needed.
Create an authorization URL and its paired state.
Exchange an authorization code for an access token.
Refresh an OAuth access token.
Create an OAuth authenticator from a token response.
Create an OAuth authenticator.
Retrieve the authenticated OAuth user.
Resolve the refresh-token request.
Validate returned OAuth state against the expected state.
Details
in
HasOAuthConfig at line 24
OAuthConfig
oauthConfig()
Get the OAuth 2 configuration.
in
HasOAuthConfig at line 32
abstract protected OAuthConfig
defaultOAuthConfig()
Define the default OAuth 2 configuration.
in
ParsesOAuthTokenResponses at line 25
protected array
parseOAuthTokenResponse(Response $response)
Parse the access token, expiry and data of a token response.
in
ParsesOAuthTokenResponses at line 42
protected array|null
resolveOAuthScopes(mixed $scopes)
Resolve the scopes reported by the provider.
in
ParsesOAuthTokenResponses at line 60
protected CarbonImmutable|null
resolveOAuthExpiry(mixed $expiresIn)
Resolve an OAuth token expiry.
at line 41
OAuthAccountAuthenticator
accountAuthenticator(OAuthAccount $account, callable|null $requestModifier = null)
Authenticate a connected account and renew its stored credentials when needed.
at line 60
AuthorizationUrl
authorizationUrl(array $scopes = [], string|null $state = null, string $scopeSeparator = ' ', array $additionalQueryParameters = [], string|null $codeChallenge = null, string $codeChallengeMethod = 'S256')
Create an authorization URL and its paired state.
at line 116
OAuthAuthenticator|Response
getAccessToken(string $code, string|null $state = null, string|null $expectedState = null, bool $returnResponse = false, callable|null $requestModifier = null, string|null $codeVerifier = null)
Exchange an authorization code for an access token.
at line 160
OAuthAuthenticator|Response
refreshAccessToken(OAuthAuthenticator|string $refreshToken, bool $returnResponse = false, callable|null $requestModifier = null)
Refresh an OAuth access token.
at line 196
protected OAuthAuthenticator
createOAuthAuthenticatorFromResponse(Response $response, string|null $fallbackRefreshToken = null)
Create an OAuth authenticator from a token response.
at line 217
protected OAuthAuthenticator
createOAuthAuthenticator(string $accessToken, string|null $refreshToken = null, DateTimeImmutable|null $expiresAt = null, array|null $scopes = null)
Create an OAuth authenticator.
at line 234
Response
getUser(OAuthAuthenticator $oauthAuthenticator, callable|null $requestModifier = null)
Retrieve the authenticated OAuth user.
at line 250
protected Request
resolveAccessTokenRequest(string $code, OAuthConfig $oauthConfig)
Resolve the access-token request.
at line 258
protected Request
resolveRefreshTokenRequest(OAuthConfig $oauthConfig, string $refreshToken)
Resolve the refresh-token request.
at line 269
protected Request
resolveUserRequest(OAuthConfig $oauthConfig)
Resolve the authenticated-user request.
at line 277
protected void
validateState(string|null $state, string|null $expectedState)
Validate returned OAuth state against the expected state.