Why do I have to keep Authenticating with Xero?
If you are linking your existing FileMaker solution to the fmEcommerce Link file and are continually prompted to authenticate when uploading or downloading to Xero:
you should check to ensure that the
OnFirstWindowOpen Script in the fmAccounting Link (Xero Edition) file is being performed. You don't need to continually authenticate with the Xero API - as long as you're making a call to the Xero API at least once every 60 days the Xero Access Token should be automatically refreshed by our scripts.
If you're calling scripts in our file from your file and you're not directly opening the fmAccounting Link file (e.g. it remains hidden) there's a strong possibility that the OnFirstWindowOpen Script is not being performed. If you don't open the file explicitly the OnFirstWindowOpen script trigger might not be called, which means the
$$fmXeroAuthenticated global variable that is set by the OnFirstWindowOpen Script to indicate that you have already authenticated with Xero isn't being set which would cause the script that uploads an Invoice etc to believe that you haven't authenticated and need to do this again.
You could just perform this script from your file prior to any Xero uploading scripts to ensure it has been performed and that the $$fmXeroAuthenticated global variable is first set correctly in the fmAccounting Link (Xero Edition) file. You could also set a global variable in your file to track whether the OnFirstWindowOpen Script has been performed in the fmAccounting Link file as this only needs to be performed once per user session.
The Xero API Token Management: Best Practices and Troubleshooting guide also has a lot of useful information.