witspry-auth-ng-client 1.3.4 → 1.3.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.
package/package.json
CHANGED
|
@@ -203,7 +203,12 @@ function handle401Error(
|
|
|
203
203
|
// Redirect to logout route if configured
|
|
204
204
|
if (config.logoutRedirectRoute) {
|
|
205
205
|
logInfo(logLevel, `Redirecting to logout route: ${config.logoutRedirectRoute}`);
|
|
206
|
-
router.navigate([config.logoutRedirectRoute]
|
|
206
|
+
router.navigate([config.logoutRedirectRoute], {
|
|
207
|
+
queryParams: {
|
|
208
|
+
redirect_url: config.redirectUri,
|
|
209
|
+
client_id: config.clientId
|
|
210
|
+
}
|
|
211
|
+
});
|
|
207
212
|
}
|
|
208
213
|
} else {
|
|
209
214
|
logInfo(logLevel, 'Network/server error, not clearing tokens');
|
|
@@ -58,6 +58,9 @@ export interface OAuth2Config {
|
|
|
58
58
|
|
|
59
59
|
/** To specify well known OAuth Provider */
|
|
60
60
|
oAuthProvider?: 'google' | 'witsauth';
|
|
61
|
+
|
|
62
|
+
/** UI Theme preference (optional) */
|
|
63
|
+
theme?: 'light' | 'dark' | 'system' | (() => 'light' | 'dark' | 'system' | string);
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
/**
|
|
@@ -226,6 +226,12 @@ export class OAuth2Service implements OnDestroy {
|
|
|
226
226
|
this.storageService.setItem(OAUTH2_STORAGE_KEYS.STATE, state);
|
|
227
227
|
this.storageService.setItem(OAUTH2_STORAGE_KEYS.NONCE, nonce);
|
|
228
228
|
|
|
229
|
+
// Evaluate theme if configured
|
|
230
|
+
let themeVal: string | undefined;
|
|
231
|
+
if (this.config.theme) {
|
|
232
|
+
themeVal = typeof this.config.theme === 'function' ? this.config.theme() : this.config.theme;
|
|
233
|
+
}
|
|
234
|
+
|
|
229
235
|
// Build authorization request
|
|
230
236
|
const authRequest: AuthorizationRequest = {
|
|
231
237
|
client_id: this.config.clientId,
|
|
@@ -236,7 +242,8 @@ export class OAuth2Service implements OnDestroy {
|
|
|
236
242
|
scope: this.config.scope,
|
|
237
243
|
code_challenge_method: pkceChallenge.codeChallengeMethod,
|
|
238
244
|
code_challenge: pkceChallenge.codeChallenge,
|
|
239
|
-
state
|
|
245
|
+
state,
|
|
246
|
+
theme: themeVal
|
|
240
247
|
};
|
|
241
248
|
|
|
242
249
|
// Build authorization URL
|
|
@@ -814,7 +821,12 @@ export class OAuth2Service implements OnDestroy {
|
|
|
814
821
|
// Redirect to logout route if configured
|
|
815
822
|
if (this.config.logoutRedirectRoute) {
|
|
816
823
|
this.logInfo('Redirecting to logout route: ', this.config.logoutRedirectRoute);
|
|
817
|
-
this.router.navigate([this.config.logoutRedirectRoute]
|
|
824
|
+
this.router.navigate([this.config.logoutRedirectRoute], {
|
|
825
|
+
queryParams: {
|
|
826
|
+
redirect_url: this.config.redirectUri,
|
|
827
|
+
client_id: this.config.clientId
|
|
828
|
+
}
|
|
829
|
+
});
|
|
818
830
|
}
|
|
819
831
|
|
|
820
832
|
} catch (error) {
|
|
@@ -829,7 +841,12 @@ export class OAuth2Service implements OnDestroy {
|
|
|
829
841
|
// Redirect to logout route if configured
|
|
830
842
|
if (this.config.logoutRedirectRoute) {
|
|
831
843
|
this.logInfo('Redirecting to logout route: ', this.config.logoutRedirectRoute);
|
|
832
|
-
this.router.navigate([this.config.logoutRedirectRoute]
|
|
844
|
+
this.router.navigate([this.config.logoutRedirectRoute], {
|
|
845
|
+
queryParams: {
|
|
846
|
+
redirect_url: this.config.redirectUri,
|
|
847
|
+
client_id: this.config.clientId
|
|
848
|
+
}
|
|
849
|
+
});
|
|
833
850
|
}
|
|
834
851
|
}
|
|
835
852
|
}
|