
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
oidc-jwt-client
Advanced tools
Fetch JWTs for API access from oidc-jwt-provider
npm install oidc-jwt-client --save
<OidcJwtProvider
client={{ url: 'https://api-auth.acc.titan.awssdu.nl' }}
shouldAttemptLogin={false}
shouldMonitorAccessTokens={false}
>
// Contents of your app
</OidcJwtProvider>
Within the provider we make use of several hooks to use the functionality exposed within the context.
The accessToken is directly returned from the fetchAccessToken function when already present and valid. If not it will automatically fetch a new accessToken for you.
To get the accessToken you can do this:
const [token, setToken] = useState<null | string>(null);
const fetchAccessToken = useAuthAccessToken();
useEffect(() => {
fetchAccessToken().then((token) => {
setToken(token);
});
}, [fetchAccessToken, setToken]);
To login or logout a user manually you can make use of these two function exposed by the useAuthControls hook:
const { authorize, logout } = useAuthControls();
const onClickLogout = React.useCallback(() => {
logout();
}, [logout]);
const onClickLogin = React.useCallback(() => {
authorize();
}, [authorize]);
Checks when the loadInitialData function load on is done executing and will return with the claims or null, depending on if you were logged in or logged out on initialization. Default is undefined.
const initializedData = useAuthInitialized();
console.log('This is the initialized data: ', initializedData)
To get the user info you can do this within the context of the provider:
const { value, loading } = useAuthUserInfo();
console.log('This is the userInfo: ', value)
To get the claims you can do this within the context of the provider:
const { value, loading } = useAuthAccessClaims();
console.log('This are the claims: ', value)
Checking if the user is logged in so that you can act on it.
const isLoggedIn = useAuthIsLoggedIn();
console.log('Is the user loggedin? ', isLoggedIn)
Checking if the user has an active session
const { hasSession } = useAuthSessionInfo();
console.log('Does the user have a session? ', hasSession)
FAQs
Fetch JWTs for API access from oidc-jwt-provider
We found that oidc-jwt-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.