function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alex_GroagAlex_Groag 

sharepoint oauth token expired

Hi - I'm getting this error in Salesforce when trying to access documents in Sharepoint, "External Object Error OAuth token expired." I've tried getting in contact with Sharepoint support but they told me to contact Salesforce, and we don't have the premium support for developer support from Salesforce.  

Name items_Sharepoint
External Data Source Sharepoint
Status OAuth token expired

Does anyone have experience with Sharepoint and refreshing a security token? I've tried to go through documentation but I'm having trouble getting the connection working again.  

I can see sharepoint in our external data sources as well as Auth. Providers.  
 
Kevin RidleyKevin Ridley
Well I'm not a Sharepoint or SF expert but I have done many OAuth token requests.  If the resource you are trying to access is on Sharepoint, then they should be able to provide the support for you.  The basics are, you should have some sort of service account setup for Sharepoint.  The service account will have a client_id and client_secret associated to it.  There's several different oauth grant types, but most common are password flow and client credentials.  With both, you make a token request with your client_id and client secret and get an access token returned.  In the password flow, you need to give your userid and pw as well.  In some cases, the token either never expires, expires in a year or 2, or sometimes less.  If it's less, they usually give you a refresh token you can use to make another request.  Some organizations, like DropBox, do it a little different.  They allow you to generate the oauth token when you create your connected app (service account) right from their developer console just by clicking a button.  You'll have to contact Sharepoint, or Google how their access tokens and service accounts work.  You really need to find the code that makes the token request though, you should just be able to run it again to generate a new token.

Good luck,
Kevin
Muna Jamous5Muna Jamous5
Hi Alex,
I am having the same issue we are getting the error "Can't access external source. External data source is unavailable because of an error.", were you able to find a solution?

Regrads,
Muna