cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CedricS
Regular Visitor

Custom Connector OAUTH not sending/requesting authorization token

Hi,

I am trying to create a custom connector to connect to the Google Analytics Reporting API. For this I need to authenticate using OAUTH 2.0, I then use the "Google format" for the authorization, Once I complete all the other steps correctly (already done it with mock servers using postman) I arrive at the test but keep getting a 401 with the body telling me I need to authenticate. Which is weird because since I set up the authorization tab it should do it on its own. Just seems like the connector never request the authorization token. Maybe I am mising a step but I have seen anything making me think so.

I know the URI are all fine since via Postman I can make it work. Just can't seem to make it work with the Connector and the Google API.

Any ideas are welcome and thank you for your help.

9 REPLIES 9
murshed
Microsoft
Microsoft

Hi @CedricS 

Can you please tell me more what you mean by "Google format" for the authorization?
The authorization tab is for defining how to authenticate. When you are testing or using it you will need to create a connection based on the definition in the authorization tab. If you can share the screenshot of the authorization and postman configuration I might be able to provide more context.

 

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

shyamsu
Power Automate
Power Automate

As per the google docs : https://developers.google.com/analytics/devguides/reporting/core/v4/authorization 

Google Analytics Reporting API uses standard OAuth 2.0. You will need to create an app in google API console which may require approval from Google. Once you app is approved, it will give you clientId and secret. You need to specify this in the security tab of the custom connector along with other parameters (e.g. Authorization url, token url etc.). Once custom connector is created, for using it, as @murshed  said, you will need to create a connection. When a connection is created PowerAutomate will automatically fetch/refresh the access token using the setting defined in the security tab of the custom connector

CedricS_0-1605533132975.png

This is the authorization tab. I do have the client ID and Client secret from ten APP i registered within Google Analytics Reporting.
The google format is the drop down list "Fournisseur d'identité" (sorry for the layout being in French), I can't choose anything else because the API doesn't give me a refresh token URI as requested with the Raw OAUTH2 option.
So once I get all the correct information in the inputs, once I get to the test tab I run the test and get a 401 response : 

{
"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"
}
}

 

Whereas through postman since it demands a user input to get the token I don't have any problems getting the token anyway and the URIs match those I put in the connector.
It just seems like the connector is not requesting or not sending the token. Am I missing a step ?

Thanks for the Help.

shyamsu
Power Automate
Power Automate

@CedricS do you have clientRequestId of the failed request (it should be in the failed response) if not, can you please send me your custom connector URL and approx time of the failure?

CedricS
Regular Visitor

@shyamsu I don't see any parameters like that in the response. Here see the URL : https://make.powerapps.com/environments/0c2c8cc1-2232-4f0d-91f4-fe29f40d2f2d/customconnectors

 

EDIT : As for the time I just did a request some minutes ago

 

On a side note, if I use the editor swagger to authorize myself manually, and then do the request everything works well.

shyamsu
Power Automate
Power Automate

@CedricS can you please click edit next to your custom connector and then send me the URL? That URL will have Id of custom connector which i can use to look into telemetry

@shyamsu The url isn't changing once I edit tho. it just opens the settings without adding a path. Is there a way to get the Id from another source ? or share the connector ?

shyamsu
Power Automate
Power Automate

@CedricS can you please send me just the name of the custom connector. I can try to look for that.

Hello Sorry for the delay, the name is "RESAH_STATS_EA" on this URL: https://make.powerapps.com/environments/0c2c8cc1-2232-4f0d-91f4-fe29f40d2f2d/customconnectors

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (43,845)