ssh-22 / chat Goto Github PK
View Code? Open in Web Editor NEWLine-style Chat app built with Node.js and React
Line-style Chat app built with Node.js and React
ClouflareのDurable ObjectsかKVを使えばいけそう
done
done
Auth0を使用してGoogleログイン&サインアップ機能を実装するには、以下の手順を行います。
Auth0アカウントを作成する
Auth0のウェブサイトにアクセスし、アカウントを作成します。無料でサインアップできます。
Auth0アプリケーションを作成する
Auth0ダッシュボードから新しいアプリケーションを作成します。アプリケーションを作成する際に、使用する認証プロバイダーとしてGoogleを選択します。
Reactアプリケーションを作成する
Reactアプリケーションを作成します。必要に応じて、React用の開発環境をインストールします。
Auth0 React SDKをインストールする
npmパッケージマネージャーを使用して、Auth0 React SDKをインストールします。以下のコマンドを使用します。
npm install @auth0/auth0-react
Auth0Providerを設定する
Auth0Providerコンポーネントを使用して、認証プロバイダーの情報をReactアプリケーションに提供します。以下のコードをindex.jsに追加します。
import React from 'react';
import ReactDOM from 'react-dom';
import { Auth0Provider } from '@auth0/auth0-react';
import App from './App';
ReactDOM.render(
<Auth0Provider
domain={process.env.REACT_APP_AUTH0_DOMAIN}
clientId={process.env.REACT_APP_AUTH0_CLIENT_ID}
redirectUri={window.location.origin}
>
<App />
</Auth0Provider>,
document.getElementById('root')
);
Google認証プロバイダーを設定する
Auth0ダッシュボードから、Google認証プロバイダーを設定します。Google認証プロバイダーの設定には、GoogleのAPIキーなどが必要です。
Googleログイン&サインアップボタンを追加する
Reactコンポーネントを使用して、Googleログイン&サインアップボタンを実装します。以下は、例です。
import React from 'react';
import { useAuth0 } from '@auth0/auth0-react';
function LoginButton() {
const { loginWithRedirect } = useAuth0();
return (
<button onClick={() => loginWithRedirect()}>
Log in with Google
</button>
);
}
function LogoutButton() {
const { logout } = useAuth0();
return (
<button onClick={() => logout()}>
Log out
</button>
);
}
function App() {
const { isAuthenticated } = useAuth0();
return (
<div>
{isAuthenticated ? <LogoutButton /> : <LoginButton />}
</div>
);
}
export default App;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.