Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,20 @@ Service_.prototype.getAccessToken = function() {
return token.access_token;
};

/**
* Gets an id token for this service. This token can be used in HTTP
* requests to the service's endpoint. This method will throw an error if the
* user's access was not granted or has expired.
* @return {string} An id token.
*/
Service_.prototype.getIdToken = function() {
if (!this.hasAccess()) {
throw new Error('Access not granted or expired.');
}
var token = this.getToken();
return token.id_token;
};

/**
* Resets the service, removing access and requiring the service to be
* re-authorized.
Expand Down