Problem
what is happening is user_email_verification config if has a value this function variable_get() just returns the value as it is in the database and php stores boolean values as for true it is 1 for false it is 0 .. so for users who are either approved by admin or do not require user email verification in this case the above function return a default value which is set to TRUE but if any user whose needs and had user_email_verification field value set returns a raw value as 1 for true and 0 for false.
Steps to reproduce
Step 1: Try to authenticate with a user having verified his account by email and the oauth client expecting the user info as below :
{
"sub": "1",
"email": "sankettejas@gmail.com",
"email_verified": 1,
"name": "admin",
"preferred_username": "admin",
"zoneinfo": "Asia/Kolkata",
"given_name": null,
"family_name": null,
"roles": [
"authenticated user",
"administrator"
]
}
throws an error saying expected boolean received integer for a field.
Proposed resolution
Wrapping the below code at
if (in_array('email', $requested_scopes)) {
$claims['email'] = $account->mail;
$claims['email_verified'] = variable_get('user_email_verification', TRUE);
}
to
if (in_array('email', $requested_scopes)) {
$claims['email'] = $account->mail;
$claims['email_verified'] = boolval(variable_get('user_email_verification', TRUE));
}
with boolval() php to return boolean value should help resolve this.
Issue fork oauth2_server-3468873
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
tdnshah commentedComment #4
tdnshah commentedComment #5
keshavv commentedComment #7
tdnshah commented@cafuego Can we closed this issue if it has been committed ?
Comment #8
cafuego commentedWe can, I forgot to set the issue to fixed so the site didn't auto-close it. D'oh!
Comment #9
cafuego commentedComment #10
cafuego commented