GitHubOAuthService
GitHub OAuth 2.0 protocol implementation. Handles the authorization code flow: build auth URL, exchange code for token, and fetch user info from the GitHub API.
GitHubOAuthService::__construct()
public function __construct(string $clientId, string $clientSecret):Parameters
| Name | Type | Description |
|---|---|---|
| $clientId | string | |
| $clientSecret | string |
GitHubOAuthService::getAuthUrl()
public function getAuthUrl(string $redirectUri, ?string $state = null): stringBuild the GitHub authorization URL requesting the read:user and user:email scopes.
Parameters
| Name | Type | Description |
|---|---|---|
| $redirectUri | string | |
| $state | ?string |
GitHubOAuthService::exchangeCode()
public function exchangeCode(string $code, string $redirectUri): Milpa\OAuth\DTO\GitHubUserInfoExchange the authorization code for an access token, then fetch the profile from the GitHub REST API.
Parameters
| Name | Type | Description |
|---|---|---|
| $code | string | |
| $redirectUri | string |