Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Objective: Embed PowerBI report in Salesforce
Issues: API Authentication/Stale token stored in Salesforce
Details:
I had followed the blog post on how embedding within Salesforce found here: https://powerbi.microsoft.com/en-us/blog/embedding-a-power-bi-report-into-salesforce/
And was ultimately successful in getting the page to render in Salesforce, but only after hard coding values like client_id and client_secret in the Apex Classes (there was an error in my definition of the Custom Setting that caused accessing the values to fail).
While reconstructing the provided code, one of the trouble shooting steps I took ultimately broke the embedding.
So, there are two problems.
A. The authentication token stored in Salesforce after hard-coding the client info is no longer valid (I recreated the app in AAD as another trouble shooting step)
- Despite attempts to invoke the token grant process to create a new token, I was never able to successfully overwrite the one stored
- Now I get a 403 Forbidden error in the console logs when trying to load the VisualForce page
B. In trying to learn more about the API through testing with Postman (based on this post: https://community.powerbi.com/t5/Developer/Power-BI-REST-API-using-postman-generate-embed-token/m-p/... ), I've been recieving errors initially of the form:
{
"error": "invalid_grant",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password
"error_codes": [
70002,
50126
],
}
And now:
{
"error": "unauthorized_client",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50053: You've tried to sign in too many times with an incorrect user ID or password.
"error_codes": [
70002,
50053
],
}
Despite being the correct credentials.
Any help is appreciated and I'm happy to provide more detail if necessary.
Hi @Anonymous,
Regarding to issue A:
1. The client info, like client id and client secret, is surely stable. So you can hard-code them. Did you get error message that the client info is invalid?
2. Did you upload all the things in the guide post?
Regarding to issue B:
Can you provide more info? Or I would suggest you open a support ticket here.
Best Regards,
Dale
Background information: The report is located in a Premium capacity workspace and the hope is to distribute the report to the Sales team without needing to grant licenses.
Some additional information about the steps I took:
Once all of these steps have been completed the iframe renders within Salesforce, but displays "This content is not available". Based on this blog post ( https://www.linkedin.com/pulse/success-power-bi-embedded-salesforce-fred-kaffenberger/ ) my next debugging step would be to use Fiddler to inspect the requests/replies. I'll work on that, but hopefully this additional information might point out where I went wrong.
Let me know if you have any ideas.
Thanks!
Hi @v-jiascu-msft,
Thanks for getting back to me!
1. I was able to successfully embed the report when the values were hard coded. This led me to believe the values in the Custom Setting were wrong so I deleted the Custom Setting and the App in AAD and recreated both, however, the issue ended up being that I named the Custom Setting 'PowerBI' instead of PowerBI. Now that the Custom Setting is named properly, Salesforce can access client_id, client_secret, etc, but the AccessToken and RefreshToken that are stored are for a different App so the authentication fails. I've been unable to overwrite the AccessToken and RefreshToken stored by Salesforce despite attempts to re-initiate the login process.
Research into how to overwrite OAuth tokens in Salesforce hasn't been fruitful so I'm hoping someone who understands the authenication process better might have some insight.
2. I have followed all of the steps in the guide. After the hard coded version worked I made sure all of the necessary parts exist within Salesforce and are named correctly.
As for B, I'll look into a support ticket for now.
Thank you for your time.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
2 | |
2 | |
1 | |
1 |