Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-oauth

> 前端框架
Open source

Google OAuth2 using the new Google Identity Services SDK for React

1.3K stars0 likes1 views
WebsiteGitHub

About

Google OAuth2 using the new Google Identity Services SDK for React


Overview

React OAuth is a collection of production-ready OAuth2 libraries for React applications. Each package is designed to be simple, type-safe, and easy to integrate into your projects.

Packages

Package Description NPM
@react-oauth/google Google OAuth2 using the new Google Identity Services SDK
@react-oauth/github Modern React hook for GitHub OAuth authentication

Quick Start

Google OAuth

bash
npm install @react-oauth/google
# or
yarn add @react-oauth/google

Basic Usage:

javascript
import { GoogleOAuthProvider, GoogleLogin } from '@react-oauth/google';

function App() {
  return (
    ">
       {
          console.log(credentialResponse);
        }}
        onError={() => {
          console.log('Login Failed');
        }}
      />
    
  );
}

Features:

  • ✅ Sign In With Google button
  • ✅ One-tap sign-up
  • ✅ Automatic sign-in
  • ✅ Custom login buttons
  • ✅ Implicit & Authorization Code flows
  • ✅ Full TypeScript support

View Full Google Documentation →


GitHub OAuth

bash
npm install @react-oauth/github
# or
yarn add @react-oauth/github

Basic Usage:

javascript
import { useGitHubLogin } from '@react-oauth/github';

function LoginButton() {
  const { initiateGitHubLogin, isLoading } = useGitHubLogin({
    clientId: 'your-github-client-id',
    redirectUri: 'http://localhost:3000/callback',
    onSuccess: response => {
      console.log('Authorization code:', response.code);
      // Exchange code for access token on your backend
    },
    onError: error => {
      console.error('Authentication failed:', error);
    },
  });

  return (
    
      {isLoading ? 'Loading...' : 'Sign in with GitHub'}
    
  );
}

Features:

  • ✅ Production-ready React hook
  • ✅ Fully typed with TypeScript
  • ✅ Zero runtime dependencies
  • ✅ Flexible API with complete UI control
  • ✅ Comprehensive error handling
  • ✅ Built-in CSRF protection

View Full GitHub Documentation →


Documentation

Google OAuth

  • Complete API Reference - Full documentation with all props, hooks, and examples
  • Google Identity Services Docs - Official Google documentation
  • Live Demo - Interactive playground for Google OAuth

GitHub OAuth

  • Complete API Reference - Full documentation with examples and error handling
  • GitHub OAuth Docs - Official GitHub OAuth documentation

Demo

Check out the live demo to see the Google OAuth package in action:

https://react-oauth.vercel.app/ (Google OAuth only)


Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptauthenticationgoogleloginoauth

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架