Hi Docebo,
I am struggling to obtain an access token via PowerBI.
I started from DanBrill’s helpful post here:
But I am hitting the same general issue that user gogrizz mentioned several posts down. PowerBI sends an error that it is not able to authenticate with the credentials provided.
PowerBI is able to retrieve a token using the Client Credentials grant type, but this token will not allow me to use the 7.0 APIs (as mentioned in the Docebo Help File https://help.docebo.com/hc/en-us/articles/360020082060-APIs-authentication#h_01HJ6PBHP8F9MNAGNRSSJ7H9FK)
This is particularly confusing because I am able to obtain a working access token using the same credentials through other apps like Insomnia.
I feel like there must be a credential type mismatch somewhere that I’m missing, but I am fully stuck on where to look. Any help would be awesome!
My query is as follows:
let
// Define the token endpoint URL
tokenUrl = pTokenURL,
// Set up the request headers
headers = r
#"Content-Type" = "application/x-www-form-urlencoded"],
// Create the request body
body = Text.ToBinary("grant_type=password&client_id="& pClientID & "&client_secret="&pClientSecret&"&username="&pUserName&"&password="&pUserPass),
// Make the HTTP POST request
response = Web.Contents(tokenUrl,
Headers = headers,
Content = body
]),
// Parse the JSON response to get the token
jsonResponse = Json.Document(response),
accessToken = jsonResponsecaccess_token]
in
accessToken