Forum Discussion

mmangan's avatar
mmangan
Regular Visitor
6 years ago

PBI Service Salesforce Refresh fails with token error

We have a report just published that links with our Salesforce system.  It connects just fine within PBI Desktop.  When trying to enter credentials and refresh the Salesforce link online, it fails with this message:  "Failed to update data source credentials: The service returned an invalid token".  Status Code = 400.    

 

The credentials are fine.  They were entered, and verified with the authenticator app, and received the big green check mark from salesforce.  Then it returns to Powerbi with the failure above.  This is production salesforce.  The Salesforce OAuth packages have been installed for PowerBI.  I've tried every possible privacy level option.  I've tried both our custom domain and the standard login.salesforce.com.

 

Any ideas?   The only answers I've found on here all end with "Open a ticket with Microsoft".

6 Replies

  • v-diye-msft's avatar
    v-diye-msft
    Community Support

    Hi mmangan 

     

     Which authentication method do you select here? Can you edit and update the credential successfully in Power BI Service? Is gateway used here? Can you refresh the dataset properly in Power BI Desktop with the same authentication?

     

    Try use "Power Bi Service >> Data Set Settings >> Data Source Credentials >> Select the data source  > edit credentials > use "OAuth2 > Privacy level (Organizational)).

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      You can talk to your Salesforce Admins to see if the Salesforce Cloud token can be extended (hopefully indefinitly) but otherwise you will need to do the steps listed here to refresh the token on a regular interval.  To token connection is controlled by Salesforce, not Power BI (though the request to refresh the token is in Power BI).

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Yeah, those are notoriously difficult to troubleshoot in the forums. There just isn't enough information to go on. You might try running the refresh through a gateway to see if that helps, but...here it comes...

     

    You could check the Issues forum here:

    https://community.powerbi.com/t5/Issues/idb-p/Issues

    And if it is not there, then you could post it.

    If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".

  • Hi mmangan were you able to find a solution? I've used the Salesforce connector but I had some issues with my data too. As a workaround, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supermetrics (which doesn't have PBI as a destination, so you first have to export to Google Sheets and then export to PBI) and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Salesforce connector in the data sources list:

     

     

    After that, just grant access to your Salesforce account using your credentials, then on preview and destination page you will see a preview of your Salesforce fields:

     

     

    There just select the fields you need. It is also compatible with custom fields and custom objects, so you'll be able to export them through windsor.  Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url. 

     

  • Hi mmangan 

     

    The "invalid token" when Service refresh fails but Desktop works is almost always caused by Salesforce's Refresh Token Policy being set to "immediately expire" - interactive (Desktop) auth works, but the server-side refresh in Service can't renew. The fix is in Salesforce: Setup → App Manager → Power BI (Connected App) → Manage → Edit Policies → set Refresh Token Policy to "Refresh token is valid until revoked".

     

    If that's already set or doesn't help, Power BI Connector for Salesforce on AppExchange is one alternative:

     

    Why it might fit:

    Happy to set up a quick demo if it'd help - we can walk through how it handles reports with 30K+ rows and how the Power BI side connects. Just reach out via the support link.

     

    Cheers,

    Metrica Team.