oidc-react
Advanced tools
Comparing version 1.1.6 to 1.2.0
@@ -59,3 +59,3 @@ "use strict"; | ||
return props.userManager; | ||
const { authority, clientId, clientSecret, redirectUri, responseType, scope, automaticSilentRenew, } = props; | ||
const { authority, clientId, clientSecret, redirectUri, responseType, scope, automaticSilentRenew, loadUserInfo, popupWindowFeatures, popupRedirectUri, popupWindowTarget } = props; | ||
return new oidc_client_1.UserManager({ | ||
@@ -70,3 +70,6 @@ authority, | ||
scope: scope || 'openid', | ||
loadUserInfo: true, | ||
loadUserInfo: loadUserInfo != undefined ? loadUserInfo : true, | ||
popupWindowFeatures: popupWindowFeatures, | ||
popup_redirect_uri: popupRedirectUri, | ||
popupWindowTarget: popupWindowTarget, | ||
automaticSilentRenew, | ||
@@ -83,2 +86,8 @@ }); | ||
}); | ||
const signInPopupHooks = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const userFromPopup = yield userManager.signinPopup(); | ||
setUserData(userFromPopup); | ||
onSignIn && onSignIn(userFromPopup); | ||
yield userManager.signinPopupCallback(); | ||
}); | ||
react_1.useEffect(() => { | ||
@@ -116,2 +125,5 @@ const getUser = () => __awaiter(void 0, void 0, void 0, function* () { | ||
}), | ||
signInPopup: () => __awaiter(void 0, void 0, void 0, function* () { | ||
yield signInPopupHooks(); | ||
}), | ||
signOut: () => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -118,0 +130,0 @@ yield userManager.removeUser(); |
@@ -20,2 +20,6 @@ import { UserManager, User } from 'oidc-client'; | ||
automaticSilentRenew?: boolean; | ||
loadUserInfo?: boolean; | ||
popupWindowFeatures?: string; | ||
popupRedirectUri?: string; | ||
popupWindowTarget?: string; | ||
onBeforeSignIn?: () => void; | ||
@@ -27,2 +31,3 @@ onSignIn?: (userData: User | null) => Promise<void> | void; | ||
signIn: (args?: unknown) => Promise<void>; | ||
signInPopup: () => Promise<void>; | ||
signOut: () => Promise<void>; | ||
@@ -29,0 +34,0 @@ signOutRedirect: (args?: unknown) => Promise<void>; |
@@ -6,2 +6,9 @@ # Changelog | ||
# [1.2.0](https://github.com/bjerkio/oidc-react/compare/v1.1.6...v1.2.0) (2021-03-08) | ||
### Features | ||
* Add signInPopup method ([#479](https://github.com/bjerkio/oidc-react/issues/479)) ([a50c196](https://github.com/bjerkio/oidc-react/commit/a50c196bba92cc95698eb10d7e5b68eb7b0959b1)) | ||
## [1.1.6](https://github.com/bjerkio/oidc-react/compare/v1.1.5...v1.1.6) (2021-02-03) | ||
@@ -8,0 +15,0 @@ |
{ | ||
"name": "oidc-react", | ||
"version": "1.1.6", | ||
"version": "1.2.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23809
236