When you do not check the "Request email address from users" from permissions tab in twitter developer account your application will
triiger a notice:
Notice: Undefined property: stdClass::$email in Drupal\social_auth_twitter\Controller\TwitterAuthController->callback() (line 195 of modules/contrib/social_auth_twitter/src/Controller/TwitterAuthController.php).

Comments

leontin created an issue. See original summary.

gvso’s picture

Status: Active » Needs work

Thanks for reporting this!

+++ b/src/Controller/TwitterAuthController.php
@@ -191,8 +191,9 @@ class TwitterAuthController extends ControllerBase {
+      $email = !empty($user->email) ? $user->email : null;

It should be NULL

neel24’s picture

Status: Needs work » Needs review
StatusFileSize
new902 bytes

I've added a patch based on comment #2.

spokje’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new48.07 KB
new38.65 KB

I've tested patch #3.

Screenshot (3035613-Watchdog_without_patch) shows the watchdog log on a site without patch #3 applied whilst:
(1) Registering a new user through Twitter
(2) Logging in with that new user through Twitter

The Notice mentioned in the description of this issue is present.

Screenshot (3035613-Watchdog_with_patch) shows the watchdog log on a site with patch #3 applied whilst:
(1) Registering a new user through Twitter
(2) Logging in with that new user through Twitter

The Notice mentioned in the description of this issue is gone. Logging in and registering through Twitter works as expected.

Marking as RTBC.

Note: The 2 Exceptions showing upon registering/logging in are fixed in this separate issue and should be ignored in this issue.

wells’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.