
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.
An auth library for react to login with google and github. It works with redirect url to get the code and then exchange it for the access token with your server side api to get the user details.
The OAuthify library provides a seamless integration for adding OAuth-based login functionality into your React application. This package comes with pre-built components for Google and GitHub login buttons, making the OAuth flow implementation straightforward and efficient.
To install OAuthify, run:
npm install oauthify
Implementing OAuthify in your React application involves three simple steps:
<OAuthifyProvider />
.<OAuthifyRedirect />
component to handle the OAuth callback.<GoogleLoginButton />
or <GithubLoginButton />
components as needed.To use the OAuthify Provider, wrap your entire application with <OAuthifyProvider>
:
import React from 'react';
import { OAuthifyProvider, GoogleLoginButton } from 'oauthify';
const App = () => {
const handleSuccess = (response) => {
console.log('Google login success:', response);
// Handle successful login, e.g., set user info in app state
};
const handleFailure = (error) => {
console.error('Google login failure:', error);
// Handle failed login, e.g., show error message to user
};
return (
<OAuthifyProvider>
<div>
<h1>My App</h1>
<GoogleLoginButton
clientId="your-google-client-id"
onSuccess={handleSuccess}
onFailure={handleFailure}
redirectUri={`${window.location.origin}/oauthify-redirect`}
/>
</div>
</OAuthifyProvider>
);
};
export default App;
To use the Google login button:
GoogleLoginButton
component:import React from 'react';
import { GoogleLoginButton } from 'oauthify';
const App = () => {
const handleSuccess = (response) => {
console.log('Google login success:', response);
};
const handleFailure = (error) => {
console.error('Google login failure:', error);
};
return (
<div>
<GoogleLoginButton
clientId="YOUR_GOOGLE_CLIENT_ID"
redirectUri={`${window.location.origin}/oauthify-redirect`}
onSuccess={handleSuccess}
onFailure={handleFailure}
>
Login with Google
</GoogleLoginButton>
</div>
);
};
export default App;
In your router configuration file:
import { OAuthifyRedirect } from 'oauthify';
{
path: '/oauthify-redirect',
component: OAuthifyRedirect
}
To use the GitHub login button:
GitHubLoginButton
component:import React from 'react';
import { GitHubLoginButton } from 'oauthify';
const App = () => {
const handleSuccess = (response) => {
console.log('GitHub login success:', response);
};
const handleFailure = (error) => {
console.error('GitHub login failure:', error);
};
return (
<div>
<GitHubLoginButton
clientId="YOUR_GITHUB_CLIENT_ID"
redirectUri={`${window.location.origin}/oauthify-redirect`}
onSuccess={handleSuccess}
onFailure={handleFailure}
>
Login with GitHub
</GitHubLoginButton>
</div>
);
};
export default App;
We welcome and appreciate contributions! If you want to contribute, please follow these steps:
git checkout -b feature/YourFeature
).git commit -am 'Add some feature'
).git push origin feature/YourFeature
).We encourage contributions for adding support for other providers, improving documentation, and fixing bugs. If you find this project helpful, please give it a star on GitHub to help others discover it!
React, OAuth, Google Login, GitHub Login, Authentication, React Component, OAuth Provider, React OAuth, OAuthify, Login Button
This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
An auth library for react to login with google and github. It works with redirect url to get the code and then exchange it for the access token with your server side api to get the user details.
The npm package oauthify receives a total of 2 weekly downloads. As such, oauthify popularity was classified as not popular.
We found that oauthify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.