cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Narayana7481
Helper I
Helper I

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 @Narayana7481 ,

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
Narayana7481
Helper I
Helper I

Tank you all, i got my solution.

v-yingjl
Community Support
Community Support

Hi @Narayana7481 ,

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors