Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restful #79

Closed
PaoloVi opened this issue Mar 17, 2015 · 6 comments
Closed

Restful #79

PaoloVi opened this issue Mar 17, 2015 · 6 comments

Comments

@PaoloVi
Copy link

PaoloVi commented Mar 17, 2015

Do you think it is possible to configure a Restful service based on your user authentication module and, maybe, use auth_key or api_key for access-token too?

http://www.yiiframework.com/doc-2.0/guide-rest-authentication.html

@amnah
Copy link
Owner

amnah commented Mar 18, 2015

Yep, looks simple enough. Just follow the instructions and let me know if you have any problems.

Quick note: this module stores the access token in user`.`api_key

@amnah amnah closed this as completed Apr 9, 2015
@lupoalberto
Copy link

Hi amnah

first: great work with this module. Unfortunately I don't get it with my restful api. The webversion works fine, but I'm not able to connect via facebook in my api. Is there a tutorial or an example of how to handle that with your module?

@amnah
Copy link
Owner

amnah commented Dec 26, 2016

This module simply uses the official yii2-authclient extensions for handling social auth.

Unfortunately I can't seem to find any guides on how to use that extension with a rest api ... You may need to do some legwork on this one. I'd recommend asking them on the yii2 forums

@lupoalberto
Copy link

Thank you for your support. Well, as far as I know, yii2 authclient does just the authentication part and it's your module that makes the database inserts. And that's exactly what I need. In my app I already get all the facebook data including the access token. Now I'd just need to somehow take this informations and verify if the user is already in the database or not. If not, create the user, otherwise return auth-token.
Please tell me just if this may be the right way to resolve my problem, or if I misunderstood the process. However. Thanks a lot.

@amnah
Copy link
Owner

amnah commented Dec 29, 2016

Ah, gotcha. So what you want to do is look at the AuthController and read through/copy the code.

It's a bit complicated, but the basic flow is:

  1. check user_auth table if the user exists in db already. if so, use that
  2. check for existing user with the same email address. if so, associate that user_id
  3. create a new user

@lupoalberto
Copy link

Got it, thank you very much!

gonzab pushed a commit to FARO-DataLab/yii2-user that referenced this issue Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants