Forum Discussion

kristianjay's avatar
kristianjay
Frequent Visitor
3 years ago
Solved

Get token from Post API call

Hi guys,    I've tried searching the forum without luck, and I therefore hope that some of you can help me.    I'm trying to pull a token via a Post API call. I can successfully pull the date fro...
  • kristianjay's avatar
    3 years ago

    I've found a solution. See below. 

     

    let

    url = "https://login.windows.net/xxx/oauth2/v2.0/token",

    headers = [#"Content-Type" = "application/x-www-form-urlencoded"],

    postData = "grant_type=client_credentials&scope=xxx&client_id=xxx&client_secret=xxx",

    response = Web.Contents(

    url,

    [Headers = headers,

    Content = Text.ToBinary(postData)

    ]

    ),

    JsonResponse=Json.Document(response),

    access_token = JsonResponse[access_token]

    in

    access_token