AuthorizationCodeGrant
trait AuthorizationCodeGrant
Traits
Properties
| protected OAuthConfig|null | $oauthConfig | The immutable OAuth 2 configuration. |
from HasOAuthConfig |
Methods
Create an OAuth authenticator from a token response.
Create an OAuth authenticator.
Resolve an OAuth token expiry.
Create an authorization URL and its paired state.
Exchange an authorization code for an access token.
Refresh an OAuth access token.
Retrieve the authenticated OAuth user.
Resolve the access-token request.
Resolve the refresh-token request.
Validate returned OAuth state against the expected state.
Details
in
CreatesOAuthAuthenticator at line 25
protected OAuthAuthenticator
createOAuthAuthenticatorFromResponse(Response $response, string|null $fallbackRefreshToken = null)
Create an OAuth authenticator from a token response.
in
CreatesOAuthAuthenticator at line 54
protected OAuthAuthenticator
createOAuthAuthenticator(string $accessToken, string|null $refreshToken = null, CarbonInterface|null $expiresAt = null)
Create an OAuth authenticator.
in
CreatesOAuthAuthenticator at line 67
protected CarbonInterface|null
resolveOAuthExpiry(mixed $expiresIn)
Resolve an OAuth token expiry.
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.
at line 37
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 93
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 128
OAuthAuthenticator|Response
refreshAccessToken(OAuthAuthenticator|string $refreshToken, bool $returnResponse = false, callable|null $requestModifier = null)
Refresh an OAuth access token.
at line 161
Response
getUser(OAuthAuthenticator $authenticator, callable|null $requestModifier = null)
Retrieve the authenticated OAuth user.
at line 173
protected Request
resolveAccessTokenRequest(string $code, OAuthConfig $oauthConfig, string|null $codeVerifier = null)
Resolve the access-token request.
at line 186
protected Request
resolveRefreshTokenRequest(OAuthConfig $oauthConfig, string $refreshToken)
Resolve the refresh-token request.
at line 197
protected Request
resolveUserRequest(OAuthConfig $oauthConfig)
Resolve the authenticated-user request.
at line 205
protected void
validateState(string|null $state, string|null $expectedState)
Validate returned OAuth state against the expected state.