This repository was archived by the owner on Jun 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * DEPRECATED - Xero has deprecated OAuth1 support. Please use OAuth2 instead.
3+ * https://github.com/gsuitedevs/apps-script-oauth2/blob/master/samples/Xero.gs
4+ */
5+
16/**
27 * This sample demonstrates how to configure the library for the Xero API when
38 * using a private application. Although the Xero documentation calls it a
Original file line number Diff line number Diff line change 1+ /*
2+ * DEPRECATED - Xero has deprecated OAuth1 support. Please use OAuth2 instead.
3+ * https://github.com/gsuitedevs/apps-script-oauth2/blob/master/samples/Xero.gs
4+ */
5+
16/*
27 * Xero public applications guide:
38 * https://developer.xero.com/documentation/auth-and-limits/public-applications
@@ -66,21 +71,21 @@ function getService() {
6671 service . getCallbackUrl = function ( ) {
6772 return ScriptApp . getService ( ) . getUrl ( ) ;
6873 } ;
69-
74+
7075 // Override the parseToken_ method to record the time granted.
7176 var originalParseToken = service . parseToken_ ;
7277 service . parseToken_ = function ( content ) {
7378 var token = originalParseToken . apply ( this , [ content ] ) ;
7479 token . granted_time = Math . floor ( ( new Date ( ) ) . getTime ( ) / 1000 ) ;
7580 return token ;
7681 }
77-
82+
7883 // Override the hasAccess method to handle token expiration.
7984 var orginalHasAccess = service . hasAccess ;
8085 service . hasAccess = function ( ) {
8186 // First do the normal check.
8287 if ( ! orginalHasAccess . apply ( this ) ) return false ;
83-
88+
8489 // Check to see if the access token has expired
8590 // (or will expire in the next 60 seconds).
8691 var token = this . getToken_ ( ) ;
You can’t perform that action at this time.
0 commit comments