ikaras / yii2-oauth2-rest-template

Yii2 Rest APi Template with OAuth2 server
MIT License
95 stars 27 forks source link

User registration #6

Closed zolek86 closed 8 years ago

zolek86 commented 9 years ago

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?

ikaras commented 9 years ago

Not sure whether I understood you correctly, but:

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!

zolek86 commented 9 years ago

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?

ikaras commented 9 years ago

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