Solved

Sharepoin Online web connection

  • 21 February 2024
  • 4 replies
  • 95 views

Badge +3

Hi, I've been working with a web connection to Sharepoint Online, created with help from this article:

How to Create a SharePoint Web Connection for FME Form [Single Tenant]

For SharepointOnlineConnector.

 

It works for a time, but after a day or two there is a problem with refreshing my access token. This was the error message today:

Updating access token for 'Microsoft SharePoint Online'

Request to update access token failed. HTTP Error: HTTP/1.1 400 Bad Request

Python Exception <FMEWSException>: Type: 3, Number: 1, Message: Failed to get authorization header.

If I reauthenticate my web connection It works again for a time.

Any ideas what the problem may be?

icon

Best answer by kailinatsafe 22 February 2024, 21:56

View original

4 replies

Userlevel 3
Badge +13

Hello @casselgard, thanks for posting! Are you using the Sharepoint List Reader/Writer or the SharepointConnector?

For security purposes, authentication tokens almost always expire after an allotted time. The duration before expiry is determined by web application providing the token, not FME itself. Unfortunately, it doesn’t look like there is a way to configure the lifetime of a refresh token on the sharepoint side.

Another thought would be, see if there is an API call you can make at the beginning of your workspace to fetch a new refresh token each run.

We have seen others use simple workspaces to renew refresh tokens as well. If you know your token will expire in x days, you could schedule a process to read a single feature or similar to invoke the token exchange. Hope this helps, Kailin! 

Badge +3

Thanks for helping, Kailin!

I'm using the SharepointOnlineConnector.

In FME Flow I have scheduled that each night I read features using my webconnections. It has been working so far, but only four days yet.

As I understand your last section this could be a solution to keeping the connection alive "forever" withouth having to reauthenticate with my Microsoft credentials?

 

Userlevel 3
Badge +13

Hey no worries @casselgard! I suspect you will have to reauthenticate eventually, or if your Flow ever goes down for example. I know sharepoint refresh tokens have a lifetime of 24hours, so I think this should work.

Actually, it looks like you can prolong the access_token expiration to 90 days (on the sharepoint side). Happy to help, Kailin. 

Userlevel 6
Badge +33

Not sure why, but I never have to reauthentice my sharepoint online webconnection.

 

It is setup as multi tenant tho.

Reply