Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

TripIt: 1) call oauth_callback to authorize URL, 2) error message: state token is invalid or has expired #3

@wivaku

Description

@wivaku

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions