Problem/Motivation

Login with Facebook & Github clients gives following errors:

Message Notice: Undefined index: id_token in Drupal\openid_connect\OpenIDConnect->buildContext() (line 258 of /app/web/modules/contrib/openid_connect/src/OpenIDConnect.php)

TypeError: Argument 1 passed to Drupal\openid_connect\OpenIDConnect::parseToken() must be of the type string, null given, called in /app/web/modules/contrib/openid_connect/src/OpenIDConnect.php on line 258 in Drupal\openid_connect\OpenIDConnect->parseToken() (line 724 of /app/web/modules/contrib/openid_connect/src/OpenIDConnect.php)

Comments

tormi created an issue. See original summary.

tormi’s picture

Title: Logging in with Facebook & Github clients gives errors » Login with Facebook & Github clients gives errors
Issue summary: View changes
tormi’s picture

So the problem is that id_token doesn't get set for the Facebook / Github client.

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)
tormi’s picture

Status: Postponed (maintainer needs more info) » Active

No, I'm using 2.x. openid_connect.settings.yml:

always_save_userinfo: true
connect_existing_users: true
override_registration_settings: true
user_login_display: replace
redirect_login: user
redirect_logout: ''
userinfo_mappings:
  timezone: zoneinfo
  user_picture: picture
_core:
  default_config_hash: gh0A0pTCkTcEfXsCBuU0HY8jXRxIJZkJvwAq5oqKXys
jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Yes. I know you're using 2.x. Is this still a problem?

tormi’s picture

Unfortunately yes.

jcnventura’s picture

With alpha6 or the dev version?

tormi’s picture

2.x-dev

  • jcnventura committed 626ba55 on 2.x
    Issue #3217778 by jcnventura: Login with Facebook...
jcnventura’s picture

Status: Postponed (maintainer needs more info) » Fixed

Indeed. I think I see where the problem was. Can you try now?

  • jcnventura committed 67a97b3 on 2.x
    Issue #3217778 by jcnventura: Login with Facebook...
jcnventura’s picture

Some further hardening to prevent PHP warnings about undefined indexes.

tormi’s picture

Thanks! Tried Facebook client and now it gives me the following error: No "sub" found from facebook with default settings. Same applies to Github client.

  • jcnventura committed 0373e48 on 2.x
    Issue #3217778 by jcnventura: Login with Facebook...
tormi’s picture

You're the man! Thanks again, João!

jcnventura’s picture

Yes, the problem there was that we started enforcing types in functions a while ago. And the OpenIDConnect::extractSub() function only accepted arrays or nulls. I added a check to see if the first parameter was an array, but forgot the null option. I've now removed that function altogether as it was a single-use function, so it was easier to just move all its 8 lines to the place where that single call occurred.

Status: Fixed » Closed (fixed)

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