mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
adjusted token service gets for new claims
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user