oidc-jwt-client
Advanced tools
Comparing version 2.0.0 to 2.0.1-develop.1
@@ -11,5 +11,8 @@ import { AsyncState } from 'react-use/lib/useAsync'; | ||
declare function useAuthIsLoggedIn(): boolean; | ||
declare function useAuthSessionInfo(): { | ||
hasSession: boolean; | ||
}; | ||
declare function useAuthAccessToken(): { | ||
(): Promise<string | null>; | ||
}; | ||
export { useAuthControls, useAuthUserInfo, useAuthAccessClaims, useAuthIsLoggedIn, useAuthAccessToken, }; | ||
export { useAuthControls, useAuthUserInfo, useAuthAccessClaims, useAuthIsLoggedIn, useAuthAccessToken, useAuthSessionInfo, }; |
@@ -1121,2 +1121,7 @@ import React, { useReducer, useRef, useEffect, useLayoutEffect, useContext, useCallback, useState } from 'react'; | ||
} | ||
function useAuthSessionInfo() { | ||
var useStore = useOidcJwtContext().useStore; | ||
var hasSession = useStore(function (state) { return !!state.csrfToken; }); | ||
return { hasSession: hasSession }; | ||
} | ||
function useAuthAccessToken() { | ||
@@ -1128,3 +1133,3 @@ var useStore = useOidcJwtContext().useStore; | ||
export { OidcJwtProvider, useAuthAccessClaims, useAuthAccessToken, useAuthControls, useAuthIsLoggedIn, useAuthUserInfo, useOidcJwtContext }; | ||
export { OidcJwtProvider, useAuthAccessClaims, useAuthAccessToken, useAuthControls, useAuthIsLoggedIn, useAuthSessionInfo, useAuthUserInfo, useOidcJwtContext }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1129,2 +1129,7 @@ 'use strict'; | ||
} | ||
function useAuthSessionInfo() { | ||
var useStore = useOidcJwtContext().useStore; | ||
var hasSession = useStore(function (state) { return !!state.csrfToken; }); | ||
return { hasSession: hasSession }; | ||
} | ||
function useAuthAccessToken() { | ||
@@ -1141,4 +1146,5 @@ var useStore = useOidcJwtContext().useStore; | ||
exports.useAuthIsLoggedIn = useAuthIsLoggedIn; | ||
exports.useAuthSessionInfo = useAuthSessionInfo; | ||
exports.useAuthUserInfo = useAuthUserInfo; | ||
exports.useOidcJwtContext = useOidcJwtContext; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "oidc-jwt-client", | ||
"version": "2.0.0", | ||
"version": "2.0.1-develop.1", | ||
"description": "Fetch JWTs for API access from oidc-jwt-provider", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -76,1 +76,9 @@ # oidc-jwt-client | ||
``` | ||
### Check if a user has a session | ||
Checking if the user has an active session | ||
```javascript | ||
const { hasSession } = useAuthSessionInfo(); | ||
console.log('Does the user have a session? ', hasSession) | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
236592
2097
84
2