Last active
April 3, 2019 02:57
-
-
Save random82/d902eb81a1a1663fac83d035feb485d7 to your computer and use it in GitHub Desktop.
Basic HTTP authorisation with PowerQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let EncodeBasicCredentials = (UserName, Password) => | |
let | |
result = "Basic " & Binary.ToText(Text.ToBinary(#"UserName" & ":" & #"Password"),0) | |
in | |
result | |
in EncodeBasicCredentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
UserName = "USERNAME", | |
Password = "PASSWORD", | |
authHeader = EncodeBasicCredentials(UserName, Password), | |
options = [ | |
Headers = [ | |
#"Authorization"=authKey | |
] | |
], | |
Headers = options[Headers], | |
Url = "https://api.myprovider.com/api/v1.0/something.json", | |
Result = Json.Document(Web.Contents(Url, options)), | |
Result1 = Result{0} | |
in | |
Result1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment