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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AKWills
Regular Visitor

Passing parameter in Text.ToBinary

I am attempting to hand this report off to a client. I am connecting to their API via my developer credentials. I want to create a parameter so that when they open the report they have to enter their credentials to access the API. I have passed a paramter for the original API link. But I am unable to pass a parameter for where I normally enter my username and password within the query. What are my options? I have bolded the problem areas

 

 

let
GetAuth = Web.Contents(#"API",
[
Headers = [#"Accept"="application/json",
#"Content-Type"="application/x-www-form-urlencoded;charset=UTF-8"],
Content = Text.ToBinary("username=#"User Name"&password=#"Password"&grant_type=password")
]),
FormatAuthAsJson = Json.Document(GetAuth),
access_token = FormatAuthAsJson[access_token],
ReportData = Json.Document(Web.Contents(#"API2",
[

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @AKWills,

AFAIK, there are lots of methods to verify credentials, they can be attached to the header, contents(your method), query with different authorizations modes. (basic name/password or encrypted tokens and API keys...)
I'd like to suggest you contact the API developers to confirm what type of authorizations they used.

BTW, please also check the encoding of binary text if they work on the API, the basic base64 encode may not suitable with all scenarios.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

@ImkeF @edhans 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.