Needs work
Project:
HybridAuth Social Login
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2014 at 10:09 UTC
Updated:
7 May 2018 at 08:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
duozerskCould you please explain the process flow in this case? Cause I can't really imagine how it should work.
Comment #2
rakesh.nimje84@gmail.com commentedHI, I'm developing an app and I want to give to my user the possibility to login via FB account. Now I know that it is possible via browser (and it works), but how can I login with my mobile native app and then pass to hybrid auth a "token" (or similar) that say "FB login ok" ?
Or is there a possibility to call a hybridauth path that start (in background) the login phase ?
Or a service ...
thanks for all.
Comment #3
duozerskYou need to have a browser to login the user via HybridAuth as it uses redirects to the authentication provider pages and then the provider redirects back to the Drupal site with HybridAuth.
So it might be impossible to use HybridAuth for the native application login.
Hope it helps.
AndyB
Comment #4
rakesh.nimje84@gmail.com commentedThank you duozersk for your quick response.
Comment #5
Alexandr2311 commentedrakesh.nimje84@gmail.com
How do you do this task?
I have the same problem.
thanks
Comment #6
mstef commentedI think it's possible but I would need some direction from the maintainer. The way it works with other login-providers via services is the mobile app does the request to the service provider (Facebook/Twitter/etc) to get a token. The token is then passed to Drupal via Services and the magic happens from there.
So what if we had a service in Drupal that could take in a token, the provider name, and perhaps an email address? Could we initiate a login from there?
Comment #7
ziobudda commentedmstef: news about your idea ?
Thanks.
M.
Comment #8
gumdal commentedSubscribing to this as I need this in my app too. Any news / progress in this area?
Comment #9
sksanjoo2 commentedComment #10
gumdal commentedRakesh Nimje (the person who posted this feature request) has sent me few files which can be a possible solution to this feature request. I would like to explore the possibilities and try to provide a patch. I have not provided any patch until now and this is going to be my first attempt at it.
I would like to know and make sure that there are no parallel feature requests similar to this, just to avoid any duplicate efforts.
Comment #11
duozerskgumdal,
Thank you for your work on this, waiting for the results.
Thanks
AndyB
Comment #12
thomas.feichter commentedHi gundmal,
we are currently in need of the same functionality.
Would you be able to share your current code? Then we can work on a patch for hybridauth.
Thanks
Comment #13
thomas.feichter commentedUnfortunately I haven't been able to get hold of the code discussed in the previous comments, so we looked for a solution ourselves.
Attached is a patch for a hybridauth submodule, which is so far working fine for us (currently tested with one native Android app).
Apart from register and login actions the patch includes one more action to check if a profile exists already or not.
Comment #14
sac0132 commentedgumdal, any progress on this?
thomas.feichter - what version did you guys patch again?
Comment #15
thomas.feichter commentedAgainst the latest dev. But as it does not modify any existing files, it should also apply without any issues to 2.15
Comment #16
DesignerPL commentedhello,
can You share an example how to use it?
Comment #17
gumdal commentedSo very sorry for not being active, I haven't really got an opportunity to work on this due to my inexperience in PHP coding. Let me know if I can be of any help, will try to tune to my Drupal notifications hereafter!
Comment #18
leuowang commentedI have installed and enabled the patch in my drupal site. Three actions including login, register and profile_exists can be found in the services resources. But when I try to connect mysite/myapi/hybridauth/login from browser, '404 not found' is returned.
The hybridauth resource is checked and can be accessed by anonymous users. Do I miss anything?
I use HybridAuth 7.x-2.15, Services 7.x-3.16.
In addition, other services apis such as user/login work well.
Comment #19
leuowang commentedAfter some struggles, the services finally work. I can call the profile_exists, login, and register services from my app. After tracing the code of this patch, I can not still figure out what parameters should I set when I call these services. For example, 'profile' and 'mail' should be passed to profile_exists for checking, but what value should be set for 'profile' field. Is the value of 'profile' something like the Facebook id returned by the OAuth? Any suggestions will be welcome. Thanks.
Comment #20
issa.haddadinI tested the patch in comment #13 and it's working fine.
Thank you @thomas.feichter
Comment #21
aghanawi@hotmail.com commentedThis is great, what parameters do you use to call the service?
Comment #22
thomas.feichter commentedSorry, I have missed the follow up questions.
Here is some basic sample code how to use the service in Android:
Comment #23
poojasharmaece commentedI tested the patch in comment #13 and it's working fine.
Thank you @thomas.feichter
Comment #24
Shalu Kansal commentedCan anyone please tell what values should be sent in request body of postman to register or login via facebook or google for mobile app?
Comment #25
Shalu Kansal commentedComment #26
Anonymous (not verified) commentedHello.
So, upon further investigation of your code, I was noticing, that the hybridauth service resource for logging in, does not need the Facebook Token.
I guess we just take that for granted (as positive verification) that the member has a verified email address, with Facebook, and they are indeed who they say they are. (they have the proper credentials).
Because when implementing with Drupalgap, and using a custom service, all that really needs to be passed to this hybridauth service resource, is the user's (uid). Then the script will log them in.
Just wondering if I am sober here to let users who go through the process of logging in via facebook (With a access token) via the FB mobile app process, just 'login' by passing the uid, without checking that token.
I guess, by the very nature of the FB access token, the token expires every day or so, so it can't be checked (saved).
ok... just wanted to hear from somebody who successfully implemented this, that we are on the right trajectory with running a separate service, to get the uid by looking up email, and passing that through to go ahead and log them in.
Thanks,
GS
Comment #27
meladawy commentedFor anyone asking about how to use this patch through javascript. We have 3 endpoints
hybridauth/login (POST Request)
hybridauth/register (POST Request)
hybridauth/profile_exists (POST Request)
1- Login & Register request structure
2- Profile Exists request structure
Comment #28
gumdal commentedThank you @thomas.feichter for your work. I am trying to integrate the same into my website. Using postman client I am able to successfully test 'profile_exists' action with Consumer key authentication at app level.
However, I do not really understand how login / register works? I tested that registration works too with a JSON payload supplied to 'register' action (just like explained in #27), but I have the following questions:
1. How to fetch user's identifier, first name, last name, email, date of birth etc. from Facebook in a native app? Usually user will explicitly authorise the app to fetch his/her information from facebook, do we have to fetch this information and use it to create a new user account in Drupal?
2. Once registered, how do I login each time user opens the app? There should be some token mechanism if I am not wrong? I sure should not be asking for password here since the login should be authenticated by facebook as login service provider.
3. Registration response body gives me the following data, is there something which I should be using for subsequent login from the below data?
Any help would be thoroughly appreciated while I do my research in this front and I will document my findings here in the interim. Guess we will have to volunteer for proper documentation of this patch too.
Comment #29
gumdal commentedI am not sure if I am using the patch right, but when I try to login with 2 different users through this patch I am getting the session information of some other logged in user. Please have a look at the images from Postman client:
As you can see above, the response of both logins with different users gives me same session information.
Am I doing it wrong? For now I am changing the status back to "Needs work" but please feel free to update it in case if I am wrong! Also, am upgrading the priority as this thread seems to have some major attention.