Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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

  • 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.

2 Replies

  • v-yingjl's avatar
    v-yingjl
    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Tank you all, i got my solution.