Forum Discussion

richardc1's avatar
richardc1
Helper I
2 years ago
Solved

Rest API integration with Service Now getting refreshed tokens.

I have been havin trouble connecting Power BI to Service Now using the Rest API, and bearer tokens.   Please note that I cannot use Basic Auth, and am required to use oauth authority to connect.  ...
  • richardc1's avatar
    2 years ago

    Managed to resolve this myself:

     

    Added the Authorization = to body. 

     

    body = [grant_type="password", client_id=clientid, client_secret=clientsecret, username=un, password=pw, Authorization=Token],
    Data=Json.Document(Web.Contents("https://[instance].service-now.com/oauth_token.do",[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(Uri.BuildQueryString(body))])),
    access_token = Data[access_token]
    in
    access_token