AbstractController
Class Controller
- Full name: \Zemit\Modules\Oauth2\Controllers\AbstractController
- Parent class: \Zemit\Modules\Oauth2\Controller
- This class is an Abstract class
Constants
| Constant | Visibility | Type | Value | 
|---|---|---|---|
| PROVIDER_CLIENT | public | 'client' | |
| PROVIDER_FACEBOOK | public | 'facebook' | |
| PROVIDER_GITHUB | public | 'github' | |
| PROVIDER_GOOGLE | public | 'google' | |
| PROVIDER_INSTAGRAM | public | 'instagram' | |
| PROVIDER_LINKEDIN | public | 'linkedin' | 
Properties
defaultScope
public string $defaultScope
providerName
public string $providerName
sessionKey
public string $sessionKey
Methods
authorizationUrlAction
Redirect to Authorization Url
public authorizationUrlAction(?string $scope = null): \Phalcon\Http\ResponseInterface
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $scope | ?string | 
validateState
Validate State
public validateState(?string $state = null): bool
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $state | ?string | 
getAccessToken
Get Access Token
public getAccessToken(?string $code = null): \League\OAuth2\Client\Token\AccessTokenInterface
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $code | ?string | 
Throws:
refreshToken
Refresh Token
public refreshToken(?string $refreshToken = null): \League\OAuth2\Client\Token\AccessTokenInterface
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $refreshToken | ?string | 
Throws:
getToken
Use this to interact with an API on the users behalf
public getToken(\League\OAuth2\Client\Token\AccessTokenInterface $token): string
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $token | \League\OAuth2\Client\Token\AccessTokenInterface | 
getRefreshToken
Use this to get a new access token if the old one expires
public getRefreshToken(\League\OAuth2\Client\Token\AccessTokenInterface $token): ?string
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $token | \League\OAuth2\Client\Token\AccessTokenInterface | 
getExpires
Unix timestamp at which the access token expires
public getExpires(\League\OAuth2\Client\Token\AccessTokenInterface $token): ?int
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $token | \League\OAuth2\Client\Token\AccessTokenInterface | 
getResourceOwner
Requests and returns the resource owner of given access token.
public getResourceOwner(\League\OAuth2\Client\Token\AccessToken $token): \League\OAuth2\Client\Provider\ResourceOwnerInterface
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $token | \League\OAuth2\Client\Token\AccessToken |