I am new to Google Suit. As part of a requirement, we are trying to access Google Sheets from Microsoft Flows (Power Automate) using HTTP call. I have the details to access Google Sheets API such as client_id, client_secret and redirect_uri. It would be if any thoughts on the approach to achieve the authentication with the above details.
Scenario: We have some Google Sheets which holds data to be READ and WRITE Back.
I have tried calling Google Token API with below details, but getting an error
Error 400: invalid_request Required parameter is missing: response_type
Our main goal is to bypass user consent and authenticate Google APIs using client id and secret and perform the required actions on the data.
Steps performed to authenticate the Google API
Method: Get
URL: https://accounts.google.com/o/oauth2/auth
Headers:
{
"client_id": "xxxxxxxxxxx-xxxxx0r0e4oe1dllujkiejtm7ii42jqk.apps.googleusercontent.com",
"redirect_uri": "https://console.cloud.google.com",
"response_type": "code",
"scope": "https://www.googleapis.com/auth/spreadsheets",
"access_type": "offline",
"prompt": "none"
}
I am following https://developers.google.com/identity/protocols/oauth2/web-server#httprest as a reference.
Is that URL correct? Looks like it should be https://accounts.google.com/o/oauth2/v2/auth.
If the URL isn't the issue, I'd go through your Headers JSON with a fine-toothed comb. It's strange that the error message is saying that your response_type header is missing when it looks like it's right there. Make sure all your quotes and commas are where they should be, and that everything is spelled correctly.
Oh wait, I read too fast. You're passing these as headers, but they're supposed to be query parameters. See this example:
https://accounts.google.com/o/oauth2/v2/auth?
scope=https%3A//www.googleapis.com/auth/drive.metadata.readonly&
access_type=offline&
include_granted_scopes=true&
response_type=code&
state=state_parameter_passthrough_value&
redirect_uri=https%3A//oauth2.example.com/code&
client_id=client_id
So it sounds like you can add all the parameters to the URL.
Did you manage to find a solution?
Love to hear this.
Mario
Hi @krishnags , @LFoundersMario , @Jronash
I have separated this into three tutorial videos.
Video Part 1 - How to obtain authorisation code?
https://youtu.be/LtH_VOax9DU
Video Part 2 - How to obtain access and refresh tokens?
https://youtu.be/MZN74noAB2w
Video Part 3 - How to obtain bearer token using refresh token and access Google Drive API using PowerAutomate?
https://youtu.be/TLZ2WpDE7U0
Please have a look and comment.
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog