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

Commit 8ac64f4

Browse files
author
Eric Koleda
committed
Deprecate Xero OAuth1 samples.
1 parent 32f81b3 commit 8ac64f4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

samples/XeroPrivate.gs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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

samples/XeroPublic.gs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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_();

0 commit comments

Comments
 (0)