-
Notifications
You must be signed in to change notification settings - Fork 13
/
get-InitialCallURLToUserToken.pq
44 lines (44 loc) · 1.61 KB
/
get-InitialCallURLToUserToken.pq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
let
output =
(AzureADTenantID as text, AzureApplicationClientID as text) as text =>
let
scope = "https://analysis.windows.net/powerbi/api/.default",
token_uri =
"https://login.microsoftonline.com/"
& AzureADTenantID
& "/oauth2/v2.0/authorize?client_id="
& AzureApplicationClientID
& "&response_type=code&redirect_uri=http://localhost:8080&response_mode=query&scope="
& scope
& " offline_access&state=1234",
tokenResponse =
Json.Document(
Web.Contents(
token_uri,
[
Headers = [
Accept = "application/json"
],
ManualStatusHandling = {
400
}
]
)
)
in
token_uri,
documentation = [
Documentation.Name = " get-InitialCallURLToUserToken.pq ",
Documentation.Description = " Prepare the URL to call to get the user token ",
Documentation.Source = "https://www.jaknapowerbi.cz",
Documentation.Version = " 1.0 ",
Documentation.Author = " Štěpán Rešl "
]
in
Value.ReplaceType(
output,
Value.ReplaceMetadata(
Value.Type(output),
documentation
)
)