adjusted token service gets for new claims
This commit is contained in:
parent
4057c478c6
commit
6c8f2d526c
|
@ -1,6 +1,6 @@
|
||||||
function ApiService(tokenService, logoutCallback) {
|
function ApiService(tokenService, logoutCallback) {
|
||||||
//this.baseUrl = 'http://localhost:4000';
|
this.baseUrl = 'http://localhost:4000';
|
||||||
this.baseUrl = 'https://api.bitwarden.com';
|
//this.baseUrl = 'https://api.bitwarden.com';
|
||||||
this.tokenService = tokenService;
|
this.tokenService = tokenService;
|
||||||
this.logoutCallback = logoutCallback;
|
this.logoutCallback = logoutCallback;
|
||||||
|
|
||||||
|
|
|
@ -221,13 +221,21 @@ function initTokenService() {
|
||||||
TokenService.prototype.getEmail = function () {
|
TokenService.prototype.getEmail = function () {
|
||||||
var decoded = this.decodeToken();
|
var decoded = this.decodeToken();
|
||||||
|
|
||||||
var email = decoded['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'];
|
if (typeof decoded.email === 'undefined') {
|
||||||
|
|
||||||
if (typeof email === 'undefined') {
|
|
||||||
throw 'No email found';
|
throw 'No email found';
|
||||||
}
|
}
|
||||||
|
|
||||||
return email;
|
return decoded.email;
|
||||||
|
};
|
||||||
|
|
||||||
|
TokenService.prototype.getName = function () {
|
||||||
|
var decoded = this.decodeToken();
|
||||||
|
|
||||||
|
if (typeof decoded.name === 'undefined') {
|
||||||
|
throw 'No name found';
|
||||||
|
}
|
||||||
|
|
||||||
|
return decoded.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
function urlBase64Decode(str) {
|
function urlBase64Decode(str) {
|
||||||
|
|
Loading…
Reference in New Issue