Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
dmcroods-auth
Advanced tools
Croods-auth is another layer of abstraction on top of Croods, providing you with a ready-to-use solution for user authentication and permission control.
yarn add croods-auth croods react react-dom lodash react-use-form-state
Bellow is a simple example of its usage with @reach/router:
import { CroodsProvider } from 'croods'
import { Auth, authHeaders, saveHeaders } from 'croods-auth'
export default props => (
<CroodsProvider handleResponseHeaders={saveHeaders} headers={authHeaders} baseUrl="https://foo.bar">
<Router>
<Auth
Component={SomeBlockedPage}
path="/"
unauthorized={() => redirect('/sign-in')}
/>
<SignIn path="/sign-in" />
</Router>
</CroodsProvider>
)
Main concepts to notice here:
And then we implement our SignIn page:
import { useSignIn } from 'croods-auth'
const Input = ({ name, label = name, ...props }) => (
<div className="form-group">
<label htmlFor={name}>{label}</label>
<input {...props} className="form-control" id={name} />
</div>
)
export default props => {
const [{ signingIn, error, ...config }] = useSignIn({
afterSuccess: () => navigate(`/home`),
})
return (
<form {...config.formProps}>
<h2>Sign In</h2>
<Input {...config.emailProps} label="Email address" />
<Input {...config.passwordProps} />
<button type="submit" className="btn btn-primary">
{signingIn ? 'Signing in...' : 'Sign in'}
</button>
</form>
)
}
There are hooks available for all usual authentication operations (sign up, edit profile, etc).
Read more about it on the Docs!
FAQs
DMC fork of Croods-auth Authentication made easy with Croods
The npm package dmcroods-auth receives a total of 3 weekly downloads. As such, dmcroods-auth popularity was classified as not popular.
We found that dmcroods-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.