KnpUOAuth2ClientBundle and Google PHP API

  google-api, google-oauth, oauth, php, symfony

I have a Symfony 5 Application that is authenticating users by their Google account using KnpUOAuth2ClientBundle.

I now want to integrate the Google Drive API so the user can upload files to his Drive.

https://developers.google.com/drive/api/v3/quickstart/php
is giving some documentation about that.

What I am wondering: If the user is already authenticated (I have a valid user access token), do I have to run through the whole authentication process again or can I use the authentication token that was generated by KnpUOAuth2ClientBundle? And how do I get this authentication token as an object? When I am trying to get it via $client->getAccessToken() I get the error "Invalid State".

Source: Symfony Questions

LEAVE A COMMENT