Skip to content

Commit e1070b8

Browse files
author
Eric Koleda
committed
Handle token errors returned as objects instead of strings. Fixes #47.
1 parent 1675ad4 commit e1070b8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Service.gs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,14 @@ Service_.prototype.getRedirectUri = function() {
393393
Service_.prototype.getTokenFromResponse_ = function(response) {
394394
var token = this.parseToken_(response.getContentText());
395395
if (response.getResponseCode() != 200 || token.error) {
396-
var reason = [token.error, token.message, token.error_description, token.error_uri].filter(Boolean).join(', ');
396+
var reason = [
397+
token.error,
398+
token.message,
399+
token.error_description,
400+
token.error_uri
401+
].filter(Boolean).map(function(part) {
402+
return typeof(part) == 'string' ? part : JSON.stringify(part);
403+
}).join(', ');
397404
if (!reason) {
398405
reason = response.getResponseCode() + ': ' + JSON.stringify(token);
399406
}

0 commit comments

Comments
 (0)