Closed zolek86 closed 8 years ago
Not sure whether I understood you correctly, but:
api/models/User
and just add new recorde to users tableOAuth2/Request
object by $request = \OAuth2\Request::createFromGlobals()
$response = Yii::$app->getModule('oauth2')->getServer()->handleTokenRequest($request)
$response->getParameters()
Not sure if this code will work (I haven't implemented this case yet) but in such way works filsh\yii2\oauth2server\controllers\DefaultController
and it works!
What I mean is that while crating a new User model (table: user) right now I don't create any data for authorization - in table: oauth_users. So when I create a user I should also create one in oauth_users because that is the point that the authorization is made from. I'm not sure how to do that in a good way. I mean I could create new oauth_users in a crude way but that would kind kill the module encapsulation. Or is there a way to make the module authorize user data from User model?
In this repository I added one user admin@api.loc:123123123 only into users table (oauth_users is empty) and authorization (getting access token) works fine, because it (authorization) makes over User::findIdentityByAccessToken().
So, you enough to add user into users table
Hey, another thing I'm tackling right now is user registration, not sure how to add data OAuth2 module while registering a user, could You write something about it?