We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 972d837 + 73013c9 commit 551a4cbCopy full SHA for 551a4cb
src/Service.js
@@ -457,6 +457,20 @@ Service_.prototype.getAccessToken = function() {
457
return token.access_token;
458
};
459
460
+/**
461
+ * Gets an id token for this service. This token can be used in HTTP
462
+ * requests to the service's endpoint. This method will throw an error if the
463
+ * user's access was not granted or has expired.
464
+ * @return {string} An id token.
465
+ */
466
+Service_.prototype.getIdToken = function() {
467
+ if (!this.hasAccess()) {
468
+ throw new Error('Access not granted or expired.');
469
+ }
470
+ var token = this.getToken();
471
+ return token.id_token;
472
+};
473
+
474
/**
475
* Resets the service, removing access and requiring the service to be
476
* re-authorized.
0 commit comments