
Problem/Motivation
Social Auth implementers are now storing tokens to allow external modules to access more data. However, they way to retrieve them from different social networks differs which makes it confusing.
For reference, follow #2857170: Remove access token session variables if login fails, #2857305: Save access token to allow external modules to request more data, and #2857106: Get the URL to user social page
Proposed resolution
Create interfaces for different authentication methods.
As an example, Google and Facebook implementers use OAuth 2, so we can create an interface which should be use in FacebookAuthManager and GoogleAuthManager.
Remaining tasks
- Write interface for OAuth2
- Determine more authentication methods which might need an interface
API changes
External methods will need to change the way they access data.
Example for OAuth2
/* @var \Google_Client $client */
$client = $this->networkManager->createInstance('social_auth_google')->getSdk();
$this->googleManager->setClient($client)
->setAccessToken($this->session->get('social_auth_google_access_token'))
->authenticate()
$user = $this->googleManager->getUserInfo();
Comment | File | Size | Author |
---|---|---|---|
#6 | Screen Shot 2017-03-07 at 2.33.17 PM.png | 108.02 KB | Paris2020 |
Comments
Comment #3
gvsoComment #5
Paris2020 CreditAttribution: Paris2020 as a volunteer commentedI've installed the dev version module Social Auth on a new D8 site. I followed all the instructions from this documentation https://www.drupal.org/node/2764227.
Everything went well until I clicked the google plus icon. Clicking the icon leads me to the correct url
/user/login/google
as mentioned in the documentation except that it then results in an error:Fatal error: Class 'Drupal\social_auth\AuthManager\OAuth2Manager' not found in /var/www/onboarding_amazee_com_dev/public_html/web/modules/contrib/social_auth_google/src/GoogleAuthManager.php on line 12
Comment #6
Paris2020 CreditAttribution: Paris2020 as a volunteer commentedWhat's weird is that when I look in the
GoogleAuthManager.php
file on line 5Drupal\social_auth\AuthManager\OAuth2Manager
is there (see 1st attached file)Comment #7
gvsoAccording to the error
Fatal error: Class 'Drupal\social_auth\AuthManager\OAuth2Manager' not found
, it seems you didn't install the dev version of Social Auth. As stated in the documentation, Social Auth implementers dev branches are only guaranteed to work with the dev branch of Social API and Social Auth.Hope that helped!
Comment #8
gvsoComment #9
Paris2020 CreditAttribution: Paris2020 as a volunteer commentedThank you I actually just installed the dev version of social_auth_google and didn't actually install social_auth itself. Everything works as expected.
Comment #11
MaskyS CreditAttribution: MaskyS commentedDoes this issue still need to be open? @gvso
Comment #12
gvsoSo far, implementers have only need OAuth2 integration. The exception is Twitter which is still using OAuth 1 (but they are currently moving to 2). However, we can not assure that future implementers won't be using Hawk or other authentication scheme.
Comment #13
gvsoIt seems like OAuth2 is the only protocol we have had to deal so far, I'm closing this issue. We might reopen it if needed