I am trying to use the OAuth1 library for TripIt.
Issue 1:
By default, the authorization URL that is created by the library is:
https://www.tripit.com/oauth/authorize?oauth_token=7af4...96c
But TripIt expects the URL to be:
https://www.tripit.com/oauth/authorize?oauth_token=7af4...96c&oauth_callback=https://script.google.com/macros/d/MrG...b6R/usercallback
Q: is there a way to automatically create the correct URL? I now add the callback manually.
Issue 2:
With the correct URL I get a TripIt authentication page. When I click Allow the Google Apps Script macro page is opened, with the error message: The state token is invalid or has expired. Please try again.
The URL of that macro page:
https://script.google.com/macros/d/MrG...b6R/usercallback?oauth_token=7af...96c
Q: what is the cause / fix of this?
The code I use to create the service:
return OAuth1.createService('tripit')
.setRequestTokenUrl('https://api.tripit.com/oauth/request_token')
.setAuthorizationUrl('https://www.tripit.com/oauth/authorize')
.setAccessTokenUrl('https://api.tripit.com/oauth/access_token')
.setConsumerKey('73b...458')
.setConsumerSecret('2a7...a5d')
.setProjectKey('MrG...b6R')
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties())
The TripIt API documention:
http://tripit.github.io/api/doc/v1/index.html#authentication_section
Thanks in advance for any suggestions!