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
Anonymous
Not applicable

Auth key To change username and password

Hi Folks, I have an rest api post request  services am calling into power bi using below code here am using the auth key as my authorization but this authkey is keep on changes instead of auth key i have to provide basic authenticaion is username and password(For example Username : sauser, Pwd: sauser123). Please help me to change the below code instead of Authkey to username and password in my power query.

 

let
url = "https://devdata.custmoer.abc/framework/login/authPost",
body = "{""userID"":""test"",""passwordEnc"":""66"",""AdditionalInfo"":{""appName"":""ABU CEP"",""appVersion"":""10"",""KVMap"":[{""key"":""Platform"",""value"":""Test""}]}}",
Parsed_JSON = Json.Document(body),
AuthKey = "Basic c29hdXNlcjpTMGFVJDNyMjU2NTY=)",
Source = Json.Document(Web.Contents(url,[ Headers = [#"Authorization"= AuthKey ,#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] ))

in
Source

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can try like this:

[Headers =[#"Authorization"="Basic username:pasword"]]

Here is an examsple:

let
actualUrl = "URL",
options = [Headers =[#"Authorization"="Basic dXNlcm5hbWU6cGFzc3dvcmQ="]],
result = Json.Document(Web.Contents(actualUrl, options))
in
result

You can also refer the simliar thread:

Passing username and password in Basic authentication 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Tank you all, i got my solution.

v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can try like this:

[Headers =[#"Authorization"="Basic username:pasword"]]

Here is an examsple:

let
actualUrl = "URL",
options = [Headers =[#"Authorization"="Basic dXNlcm5hbWU6cGFzc3dvcmQ="]],
result = Json.Document(Web.Contents(actualUrl, options))
in
result

You can also refer the simliar thread:

Passing username and password in Basic authentication 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors
Top Kudoed Authors