We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10891e5 commit 0f9e1a8Copy full SHA for 0f9e1a8
1 file changed
Xrm.Portal.js
@@ -12,12 +12,15 @@ Xrm.Portal = {
12
/*authorize: function() {
13
},*/
14
decode: function (token) {
15
- var base64Url = token.split('.')[1];
16
- var base64 = decodeURIComponent(atob(base64Url).split('').map(function (c) {
17
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
18
- }).join(''));
19
-
20
- return JSON.parse(base64);
+ if (token !== "") {
+ var base64Url = token.split('.')[1];
+ var base64 = decodeURIComponent(atob(base64Url).split('').map(function (c) {
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
+ }).join(''));
+
21
+ return JSON.parse(base64);
22
+ }
23
+ throw "No login user is detected.";
24
},
25
get: function () {
26
return $.get("/_services/auth/token");
0 commit comments