GoogleOAuthService
Google OAuth 2.0 protocol implementation. Handles the authorization code flow: build auth URL, exchange code for token, and fetch user info. Each consumer plugin provides its own redirectUri.
GoogleOAuthService::__construct()
public function __construct(string $clientId, string $clientSecret):Parameters
| Name | Type | Description |
|---|---|---|
| $clientId | string | |
| $clientSecret | string |
GoogleOAuthService::getAuthUrl()
public function getAuthUrl(string $redirectUri, ?string $state = null): stringBuild the Google consent-screen URL, requesting offline access and forcing the consent prompt so a refresh token is issued on every authorization.
Parameters
| Name | Type | Description |
|---|---|---|
| $redirectUri | string | |
| $state | ?string |
GoogleOAuthService::exchangeCode()
public function exchangeCode(string $code, string $redirectUri): Milpa\OAuth\DTO\GoogleUserInfoExchange the authorization code for an access token, then fetch the profile from Google's userinfo endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
| $code | string | |
| $redirectUri | string |