Download the PHP package gowravshekar/yii2-oauth2-server without Composer
On this page you can find all versions of the php package gowravshekar/yii2-oauth2-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gowravshekar/yii2-oauth2-server
More information about gowravshekar/yii2-oauth2-server
Files in gowravshekar/yii2-oauth2-server
Package yii2-oauth2-server
Short Description OAuth2 Server for PHP
License MIT
Homepage https://github.com/filsh/yii2-oauth2-server
Informations about the package yii2-oauth2-server
yii2-oauth2-server
A wrapper for implementing an OAuth2 Server(https://github.com/bshaffer/oauth2-server-php)
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json.
To use this extension, simply add the following code in your application configuration:
- user model implementing an interface , so the oauth2 credentials data stored in user table
Additional OAuth2 Flags:
-
Flag that switch that state controller should allow to use "state" param in the "Authorization Code" Grant Type
- Flag that switch that controller should allow the "implicit" grant type
The next step your shold run migration
this migration create the oauth2 database scheme and insert test user credentials for
add url rule to urlManager
Usage
To use this extension, simply add the behaviors for your base controller:
Create action authorize in site controller for Authorization Code
https://api.mysite.com/authorize?response_type=code&client_id=TestClient&redirect_uri=https://fake/
Also if you set you can use Implicit Grant Type - see more
Request example:
https://api.mysite.com/authorize?response_type=token&client_id=TestClient&redirect_uri=https://fake/cb
With redirect response:
https://fake/cb#access_token=2YotnFZFEjr1zCsicMWpAA&state=xyz&token_type=bearer&expires_in=3600
For more, see https://github.com/bshaffer/oauth2-server-php