• I have a PHP Symfony 4.2 application with HWI/OAuthBundle properly configured.
  • I created an OAuth 2 key and secret.
  • I configured it in the hwi_oauth section of the symfony files.

I use it to login users via a custom UserProvider. In particular I'm concerned in overwriting the method public function loadUserByOAuthUserResponse( UserResponseInterface $response )

When the scope is:

scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"

it works perfectly. In fact, reading the $response->getData() I can see the email, the real name, and things like this.

Instead if I request for example:

scope: "https://www.googleapis.com/auth/user.birthday.read"

then I get this inside the getData() result:

    "error" => [
        "code" => 401
        "message" => "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
        "status" => "UNAUTHENTICATED"

In particular, I've previously activated the "People API" in the https://console.developers.google.com and I have set in my OAuth Consent Screen to accept all the scopes of the People API. Specifically in the Scopes for Google APIs section it appears in the list (as seen in the following image):

enter image description here


What do I have to do so when the scope is https://www.googleapis.com/auth/user.birthday.read the HWI/OAuthBundle gets valid data in the response?

0 Answers