Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
rrredirect
New Member

Power BI Customer Connector: Unsupported Grant Type Error (Vimeo API)

Hello,

 

I am attempting to create my first PowerBI Custom Connecter to connect to the Vimeo API. I am stuck on the final step of the authorization flow - getting back an access token. When trying out the Connecter in PowerBI, it seems to authenticate properly when I hit the access token endpoint, but I get back a warning "[unsupported_grant_type] Unsupported grant type" 

 

It appears I am not sending the grant_type properly in the request. Here are Vimeo's requirements of what is sent along in the body of the request:

Capture2.JPG

 

Here is a snippet of code from the Customer Connector I am building. It is within this TokenMethod function that I am trying to fufill the requirements of the image above:

 

 

 

 

TokenMethod = (grantType, tokenField, code) =>
    let
        queryString = [
            grant_type = "authorization_code",
            redirect_uri = redirect_uri,
            client_id = client_id,
            client_secret = client_secret
        ],
        queryWithCode = Record.AddField(queryString, tokenField, code),

        authKey = "Basic " & Binary.ToText(Text.ToBinary("client_id:client_secret"),BinaryEncoding.Base64),

        tokenResponse = Web.Contents(token_uri, [
            Content = Text.ToBinary(Uri.BuildQueryString(queryWithCode)),
            Headers = [
                #"Authorization" = authKey,
                #"Content-type" = "application/json",
                #"Accept" = "application/vnd.vimeo.*+json;version=3.4"
            ],
            ManualStatusHandling = {400} 
        ]),
        body = Json.Document(tokenResponse),
        result = if (Record.HasFields(body, {"error", "error_description"})) then 
                    error Error.Record(body[error], body[error_description], body)
                 else
                    body
    in
        result;

 

 

 

 

I'm wondering if someone could please point out where I might be going astray in the code and why I am recieving the [unsupported_grant_type] error.

 

Many thanks for your time,

-Josh

1 REPLY 1
v-eqin-msft
Community Support
Community Support

Hi  @rrredirect 

Sorry for that I'm not familiar with customer connector. But based on my researching,

1.The grant_type parameter must be set to “authorization_code”.

2.The grant_type , code, Client Authentication  paremeters are required.

 

So such error may be caused by the unknown "grantType"

TokenMethod = (grantType, tokenField, code) =>

Or no code parameter in 

 Eyelyn9_1-1651740006227.png

Refer to:

Authorization code flow - Azure Active Directory B2C | Microsoft Docs

 Solved: OAuth 2.0 Authorization Code flow grant type - Pow... - Microsoft Power BI Community

Authorization Code Grant - OAuth 2.0 Simplified

 

 

In addition, you may post your issue on  Developer - Microsoft Power BI Community for further helps.

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.