Forum Discussion
Issue while generating Embed token with ClientID and login credentials using EmbedApiSample
It sounds like the request you're making has the wrong body.
To manually get an access key, see this thread for details on how to get the token using the REST API.
Or follow my example using Postman (free tool, use a search engine to find it).
In the body, fill in the client_id, username and password field with your values. For grant_type, scope and resource, copy the values in my screenshot or from the link above. Make sure POST is selected and the URL is https://login.microsoftonline.com/common/oauth2/token
- Anonymous8 years agoNot applicable
Thanks for your reply. I tried following both the approaches specified by you, but both doesn't seem to work for me. not sure what is the mistake I am doing it here?
approach1: I tried calling the RestAPI service using the Restlet from chrome browser with the following data. https://login.microsoftonline.com/common/oauth2/token
{
grant_type: password
scope: openid
resource: https://analysis.windows.net/powerbi/api
client_id: ********************
username: ********************
password: ********************
}
But I am getting the error as follows:
{
"error": "invalid_request",
"error_description": "AADSTS90014: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: dea02939-adaf-44ad-9395-00dc9ba89f00\r\nCorrelation ID: d5b77411-5b4f-4858-8afd-1009ad5da0cb\r\nTimestamp: 2018-04-25 15:00:26Z",
"error_codes":[
90014
],
"timestamp": "2018-04-25 15:00:26Z",
"trace_id": "dea02939-adaf-44ad-9395-00dc9ba89f00",
"correlation_id": "d5b77411-5b4f-4858-8afd-1009ad5da0cb"
}Approach2: With the same input data and the same RestAPI url, I tried it in Postman, but I am getting different error.
{
"error": "invalid_grant",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50056: Password does not exist in store for this user\r\nTrace ID: 57573138-e630-4813-a722-a198e5997000\r\nCorrelation ID: 46099d23-a758-446c-8b91-ed18d3b8949a\r\nTimestamp: 2018-04-25 14:54:03Z",
"error_codes": [
70002,
50056
],
"timestamp": "2018-04-25 14:54:03Z",
"trace_id": "57573138-e630-4813-a722-a198e5997000",
"correlation_id": "46099d23-a758-446c-8b91-ed18d3b8949a"
}Please let me know what is the mistake here?
