@cemiar/auth-sdk 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,16 +70,21 @@ export class CemiarAuthClient {
70
70
  }
71
71
  handleRedirectMicrosoftCallback(routeQueryData) {
72
72
  const token = routeQueryData["token"];
73
- if (token) {
74
- this.setAccessToken(token);
75
- this.persistLoginMethod("microsoft");
76
- const claim = tokenToClaimBrowser(token);
77
- return {
78
- email: claim.sub,
79
- displayName: claim.displayName
80
- };
73
+ if (!token) {
74
+ console.error("No token found in Microsoft redirect callback.");
75
+ const error = routeQueryData["error"];
76
+ if (error) {
77
+ console.error("Error from Microsoft login:", error);
78
+ }
79
+ return null;
81
80
  }
82
- return null;
81
+ this.setAccessToken(token);
82
+ this.persistLoginMethod("microsoft");
83
+ const claim = tokenToClaimBrowser(token);
84
+ return {
85
+ email: claim.sub,
86
+ displayName: claim.displayName
87
+ };
83
88
  }
84
89
  getMicrosoftLoginUrl(extraParams = {}) {
85
90
  this.persistLoginMethod("microsoft");
@@ -94,7 +99,11 @@ export class CemiarAuthClient {
94
99
  return `${this.baseUrl}/microsoft?${params.toString()}`;
95
100
  }
96
101
  async refreshToken() {
97
- const data = await this.authPost("/refresh", {}, true);
102
+ const refreshPayload = {
103
+ tenantId: this.tenantId,
104
+ auds: this.auds
105
+ };
106
+ const data = await this.authPost("/refresh", refreshPayload, true);
98
107
  const accessToken = extractAccessToken(data);
99
108
  this.setAccessToken(accessToken);
100
109
  return { accessToken };
@@ -0,0 +1,4 @@
1
+ export interface RefreshPayload {
2
+ tenantId: string;
3
+ auds: string[];
4
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cemiar/auth-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Cemiar Auth integration helpers for web apps and APIs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",