Gathering detailed insights and metrics for @bcwdev/auth0provider-client
Gathering detailed insights and metrics for @bcwdev/auth0provider-client
Gathering detailed insights and metrics for @bcwdev/auth0provider-client
Gathering detailed insights and metrics for @bcwdev/auth0provider-client
npm install @bcwdev/auth0provider-client
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
56 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Feb 04, 2025
Latest Version
0.1.18
Package Id
@bcwdev/auth0provider-client@0.1.18
Unpacked Size
55.77 kB
Size
7.97 kB
File Count
9
NPM Version
10.9.2
Node Version
22.13.1
Published on
Feb 04, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
AuthService.js
1import { 2 initialize 3} from '@bcwdev/auth0provider-client' 4 5export const AuthService = initialize({ 6 domain, 7 clientId, 8 authorizationParams: { 9 redirect_uri: window.location.href 10 } 11}) 12 13// Listen for secific AUTH_EVENTS hooks 14AuthService.on(AuthService.AUTH_EVENTS.AUTHENTICATED, async () => { 15 // AuthService.user is now defined 16 AppState.user = AuthService.user 17 $resource.defaultHeaders.Authorization = AuthService.bearer 18 await profileService.getProfile() 19}) 20AuthService.on(AuthService.AUTH_EVENTS.LOADED, () => { 21 AppState.$auth = reactive(AuthService) 22})
1<script src="https://cdn.jsdelivr.net/gh/jakeoverall/auth0provider-client/browser/Auth0Provider.browser.js">
This library is a small wrapper around auth0-spa-js. It is extended beyond the simple scale that is used in the auth0 tutorial. Added features include getting the userInfo
and identity
on login.
REQUIRED: Enable RBAC in you application for the full set of features in this app. You can also add the following rule to retrieve more information in your userInfo
1// AUTH0 RULE 2function(user, context, callback) { 3 // please note auth0 will strip any non namespaced properties 4 const namespace = 'https://YOURDOMAIN.auth0.com'; 5 const assignedRoles = (context.authorization || {}).roles; 6 7 let idTokenClaims = context.idToken || {}; 8 9 idTokenClaims[`${namespace}/roles`] = assignedRoles; 10 context.idToken = idTokenClaims; 11 context.idToken[namespace + '/user_metadata'] = user.user_metadata; 12 context.idToken[namespace + '/app_metadata'] = user.app_metadata; 13 14 // namespaced properties are reduced to simple properties by this libary 15 // so in vue you can access userInfo.app_metadata directly 16 17 callback(null, user, context); 18}
You can access any of the following state properties directly from the initialized
1export const AuthService = Auth0Provider.initialize(options)
1// AuthService Properties 2{ 3 loading: true, 4 user: { 5 isAuthenticated: false, 6 // ... Auth0User 7 }, 8 userInfo: { 9 // ... Extra details provided by your Auth0Rules 10 }, 11 bearer: "", 12} 13 14// AuthService Login Methods 15{ 16 /** Awaitable Authentication opening a popup window */ 17 async loginWithPopup(o) {} 18 /** Authenticates the user using the redirect method */ 19 loginWithRedirect(o) {} 20 /** Returns all the claims present in the ID token */ 21 getIdTokenClaims(o) {} 22 /** Returns the access token. If the token is invalid or missing, a new one is retrieved */ 23 getTokenSilently(o) {} 24} 25 26// AuthService Helper Methods 27{ 28 /** 29 * Depends on UserData 30 * @param {string[] | string} permissions 31 * @returns {boolean} 32 */ 33 hasPermissions(permissions) {}, 34 35 /** 36 * Depends on UserData 37 * @param {string[] | string} roles 38 * @returns {boolean} 39 */ 40 hasRoles(roles) {}, 41} 42 43// Event Hooks 44{ 45 LOADING: "LOADING", 46 LOADED: "LOADED", 47 AUTHENTICATED: "AUTHENTICATED" 48 // LOGOUT FORCES A REFRESH SO NO HOOK HERE 49}
Caution: Auth0Provider
identity
is easily modifed on the client and therefore cannot be trusted when making server side decisions. Your server should use the bearer token and the auth0 api to validate requests see @bcwdev/auth0provider
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More