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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Doc-tan
Regular Visitor

Custom connector API - TOKEN (error binary)

I have create a custom connector but i can not see and use the token because of error

Details: "We cannot convert a value of type Binary to type Text."

at the postman i can post the same url with the same header and body and answer me with json 

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiZX",
    "refresh": "Srbwtr7J"
}
 
my code:
 
let
                        creds = Extension.CurrentCredential(),
                       
                        Response =
                       
                            Web.Contents(
                                    
                                    server &"SignIn",
                                    [
                                        Headers = [
                                                    #"Content-Type" = "application/json",
                                                    #"api-version" = "1.0"
                                                    ],
                                        Content =
                                                    Text.ToBinary(
                                                                    Json.FromValue([
                                                                    username = creds[Username],
                                                                    password = creds[Password],
                                                                    afm = "",
                                                                    code = ""
                                                                    ])
                                                                )
                                    ]
                                        ),

                       
                       
                        JsonResponse = Json.Document(Response),
                        Token =  JsonResponse[token]
1 REPLY 1
v-hjannapu
Community Support
Community Support

Hi @Doc-tan,
Thank you  for reaching out to the Microsoft fabric community forum.

The problem is happening inside the Power Query custom connector. In Power Query, the response coming from Web.Contents is treated as Binary by default. But later in the code, it’s being read like normal text/JSON. Because of this mismatch, Power Query throws the error saying it can’t convert Binary to Text, and the token is not getting read.

So this is not related to headers, body, or login details. It’s only a response handling issue in the connector. Once the response is properly handled as JSON, you should be able to access the token without any problem.

please go through with the below document hope it may resolve your Issue:
Json.Document - PowerQuery M | Microsoft Learn
Web.Contents - PowerQuery M | Microsoft Learn
Hope the above provided information help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
Regards,
Community Support Team.

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.