Download the PHP package rowasc/yii2oauthserver without Composer
On this page you can find all versions of the php package rowasc/yii2oauthserver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rowasc/yii2oauthserver
More information about rowasc/yii2oauthserver
Files in rowasc/yii2oauthserver
Package yii2oauthserver
Short Description A module that implement's TheLeague's OAuth component for Yii2
License MIT
Informations about the package yii2oauthserver
-
Copy the migration file to your own migrations directory (inside of your yii2 project) , and run the migrations. Make sure you update the client_id and client_secret before using it in your project, since they are not safe the way they are added in the migration!
-
Edit your yii2 configuration to include the following under "components"
-
Edit your yii2 configuration to include the following under "modules"
-
In your .htaccess file, allow the Authorization headers to pass, since they will be stripped most of the time witouth this line
-
Have your base api controller extend " \rowasc\yii2oauthserver\controllers\ApiController" .
-
Create an AuthorizationController, and extend \rowasc\yii2oauthserver\controllers\AuthorizationController in it.
- In your User model, extend rowasc\yii2oauthserver\models\User
This will create an "/authorization/login" and a "/authorization/logout" endpoint which will allow you to get and expire bearer tokens for your api auth.
Examples: getting a new bearer token
POST /v1/authorization/login HTTP/1.1 Host: api.yii2-starter-kit.dev Content-Type: application/json Cache-Control: no-cache Postman-Token: 7dd28588-b30d-a252-5c7e-5ecc9d1ab740
Response:
Examples: invalidating the token so users do not have access to the api
POST /v1/authorization/logout HTTP/1.1 Host: api.yii2-starter-kit.dev Content-Type: application/json Authorization: Bearer ENMTcmTSgQTmwCpVbaO3AHHbhbJYgziiZzjWzWUd Cache-Control: no-cache Postman-Token: 9b86bad2-dd05-898b-5888-6047e0dd2772
Response:
Help wanted:
This project is in need of better tests.
All versions of yii2oauthserver with dependencies
yiisoft/yii2 Version @stable
rowasc/yii2loggingutils Version *