Download the PHP package codexshaper/php-oauth2 without Composer
On this page you can find all versions of the php package codexshaper/php-oauth2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codexshaper/php-oauth2
More information about codexshaper/php-oauth2
Files in codexshaper/php-oauth2
Package php-oauth2
Short Description OAuth2 authentication for PHP.
License MIT
Homepage https://github.com/Codexshaper/php-oauth2
Informations about the package php-oauth2
Description
OAuth2 authentication for PHP
Install
Setup Database
More details about database follow this link https://github.com/Codexshaper/php-database
Migrate tables
Rollback tables
Refresh tables
Client Credentials Grant
The client sends a POST request with following body parameters to the authorization server:
`grant_type` with the value `client_credentials`
`client_id` with the client’s ID
`client_secret` with the client’s secret
`scope` with a space-delimited list of requested scope permissions.
The authorization server will respond with a JSON object containing the following properties:
`token_type` with the value Bearer
`expires_in` with an integer representing the TTL of the access token
`access_token` a JWT signed with the authorization server’s private key
Password Grant
The client then sends a POST request with following body parameters to the authorization server:
`grant_type` with the value `password`
`client_id` with the the client’s ID
`client_secret` with the client’s secret
`scope` with a space-delimited list of requested scope permissions.
`username` with the user’s username
`password` with the user’s password
The authorization server will respond with a JSON object containing the following properties:
`token_type` with the value Bearer
`expires_in` with an integer representing the TTL of the access token
`access_token` a JWT signed with the authorization server’s private key
`refresh_token` an encrypted payload that can be used to refresh the access token when it expires.
Get Access Token
The client sends a POST request with following body parameters to the authorization server:
grant_type with the value refresh_token
refresh_token with the refresh token
client_id with the the client’s ID
client_secret with the client’s secret
scope with a space-delimited list of requested scope permissions. This is optional; if not sent the original scopes will be used, otherwise you can request a reduced set of scopes.
The authorization server will respond with a JSON object containing the following properties:
token_type with the value Bearer
expires_in with an integer representing the TTL of the access token
access_token a new JWT signed with the authorization server’s private key
refresh_token an encrypted payload that can be used to refresh the access token when it expires
Get Refresh Access Token
Part One
The client will redirect the user to the authorization server with the following parameters in the query string:
response_type with the value code
client_id with the client identifier
redirect_uri with the client redirect URI. This parameter is optional, but if not send the user will be redirected to a pre-registered redirect URI.
scope a space delimited list of scopes
state with a CSRF token. This parameter is optional but highly recommended. You should store the value of the CSRF token in the user’s session to be validated when they return.
All of these parameters will be validated by the authorization server.
The user will then be asked to login to the authorization server and approve the client.
If the user approves the client they will be redirected from the authorization server to the client’s redirect URI with the following parameters in the query string:
code with the authorization code
state with the state parameter sent in the original request. You should compare this value with the value stored in the user’s session to ensure the authorization code obtained is in response to requests made by this client rather than another client application.
Part Two
The client will now send a POST request to the authorization server with the following parameters:
grant_type with the value of authorization_code
client_id with the client identifier
client_secret with the client secret
redirect_uri with the same redirect URI the user was redirect back to
code with the authorization code from the query string
Note that you need to decode the code query string first. You can do that with urldecode($code).
The authorization server will respond with a JSON object containing the following properties:
token_type with the value Bearer
expires_in with an integer representing the TTL of the access token
access_token a JWT signed with the authorization server’s private key
refresh_token an encrypted payload that can be used to refresh the access token when it expires.
Callback
All versions of php-oauth2 with dependencies
codexshaper/php-database Version ^1.0
league/oauth2-server Version ^8.1
phpseclib/phpseclib Version ^2.0
illuminate/http Version ^7.14
symfony/psr-http-message-bridge Version ^2.0
nyholm/psr7 Version ^1.2