OpenID-Connect-PHP
OpenID-Connect-PHP copied to clipboard
Clarification needed for addScope method: Avoid duplicate "openid" scope
Problem:
I encountered an issue with the addScope method when using it to add scopes to an OpenID connection. I think that the current implementation of addScope lacks of clarity around the fact that the "openid" scope is already included by default.
In my case I unintentionally duplicated the "openid" scope by calling addScope(["openid"]), which resulted in the "openid" scope being duplicated in the final list of scopes.
Code incriminated :
if (count($this->scopes) > 0) {
$auth_params = array_merge($auth_params, ['scope' => implode(' ', array_merge($this->scopes, ['openid']))]);
}
Suggestions:
-
Warning message: Implement a warning message that informs developers when they attempt to add the "openid" scope, indicating that this scope is already included by default.
-
Automatic handling: Alternatively, the addScope method could automatically ignore the addition of the "openid" scope via addScope method, thus preventing duplication.
Thank you for considering this enhancement.