Drupal\social_auth_twitter\TwitterAuthManager does not extend Drupal\social_api\AuthManager\OAuth2Manager as the facebook or google auth manager. Common code that works with social auth regardless of the service needs a common class/interface to work with any auth manager.

Comments

manuel.adan created an issue. See original summary.

gvso’s picture

The reason for this is that we're using OAuth1 not OAuth2 for Twitter since it didn't have support for OAuth2 until recently. In fact, I'm not sure if Twitter is completely supporting OAuth2 now. I might need to check

manuel.adan’s picture

Category: Bug report » Feature request

It may be useful to have a common interface that all auth managers implement regardless of the OAuth version they use. Any way, that's out of the twitter auth scope.

gvso’s picture

We could have one but we'll need to think of common functionality among all the authentication protocols.

However, I think what you're interested in is actually to get basic user info and request API endpoints which I think are common things among different protocols. We should be able to create a base interface with those methods and extend it in OAuth2Manager to not break anything.

josebc’s picture

Im getting some errors that might be related to this

"RuntimeException: Failed to start the session because headers have already been sent"
" LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected."
in /user/login/twitter
Looking at redirectToProvider in OAuth2ControllerBase you can notice they are handling it somewhat differently
https://git.drupalcode.org/project/social_auth/blob/8.x-2.x/src/Controll...

josebc’s picture

gvso’s picture

That issue is the same as #3033444: LogicException & RuntimeException on user login (which you already referenced). And of course, that patch won't work in Social Auth Twitter since this module does not extend the OAuth2ControllerBase (Twitter uses OAuth 1). However, the error is a completely different issue from this. Could you create a new issue for the error? Also, feel free to submit a patch (you can base your solution on the issue I mentioned).

abu-zakham’s picture

abu-zakham’s picture

@gvso Issue created

wells’s picture

Title: TwitterAuthManager should extends OAuth2Manager » TwitterAuthManager should extend OAuth2Manager
Version: 8.x-2.x-dev » 3.0.x-dev
Category: Feature request » Task