Download the PHP package webiik/oauth2client without Composer
On this page you can find all versions of the php package webiik/oauth2client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webiik/oauth2client
More information about webiik/oauth2client
Files in webiik/oauth2client
Package oauth2client
Short Description The OAuth2Client allows you to connect to any OAuth2 server.
License MIT
Homepage https://www.webiik.com
Informations about the package oauth2client
OAuth2Client
The OAuth2Client allows you to connect to any OAuth2 server. Just follow the procedure described in the example below.
Installation
Example
Configuration
Before you can connect to any OAuth2 server, you have to properly configure access credentials and endpoints.
setClientId
setClientId() sets client id.
setClientSecret
setClientSecret() sets client secret.
setRedirectUri
setRedirectUri() sets redirect URI to redirect a user after authorization by OAuth2 server.
setAuthorizeUrl
setAuthorizeUrl() sets URL to authorize a user by OAuth2 server.
setAccessTokenUrl
setAccessTokenUrl() sets URL to obtain a access token.
setValidateTokenUrl
setValidateTokenUrl() sets URL to validate a access token. This endpoint is not official part of OAuth2 specifications, however Google, Facebook etc. provide it.
Login
getAuthorizeUrl
getAuthorizeUrl() prepares a correct link to a URL set by setAuthorizeUrl().
Parameters
- scope defines access scope of your app. Learn access scopes of individual OAuth2 servers.
- responseType possible response types are code, token, id_token...
- state read about state parameter.
Authorization
OAuth2Client allows you to get access token by all grant types provided by OAuth2 protocol. Read more about grant types.
getAccessTokenByCode
getAccessTokenByCode() makes HTTP POST request to a URL set by setAccessTokenUrl(). Returns an array with token(s) on success and a string with cURL error message on error. This grant type is usually used by apps for authenticating users.
getAccessTokenByPassword
getAccessTokenByPassword() makes HTTP POST request to a URL set by setAccessTokenUrl(). Returns an array with token(s) on success and a string with cURL error message on error. This grant type is usually used by trusted apps for authenticating users.
getAccessTokenByCredentials
getAccessTokenByCredentials() makes HTTP POST request to a URL set by setAccessTokenUrl(). Returns an array with token(s) on success and a string with cURL error message on error. This grant type is usually used for server-to-server communication.
getAccessTokenByRefreshToken
getAccessTokenByRefreshToken() makes HTTP POST request to a URL set by refresh_token. It's used to obtain a renewed access token.
getAccessTokenBy
getAccessTokenBy() makes HTTP POST request to a URL set by setAccessTokenUrl(). Returns an array with token(s) on success and a string with cURL error message on error. This method allows you to get access token by custom parameters.
getTokenInfo
getTokenInfo() makes HTTP POST request to a URL set by setValidateTokenUrl(). Returns an array with token(s) on success and a string with cURL error message on error. This is not official part of OAuth2 specifications, however Google, Facebook etc. provide it.