Skip to content

Instantly share code, notes, and snippets.

@esneko
Created May 19, 2020 17:53
Show Gist options
  • Select an option

  • Save esneko/4aaa3d590a07048c5cc10c5ebcd5ea9d to your computer and use it in GitHub Desktop.

Select an option

Save esneko/4aaa3d590a07048c5cc10c5ebcd5ea9d to your computer and use it in GitHub Desktop.
OneGraph Auth
import OneGraphAuth from "onegraph-auth"
const auth = new OneGraphAuth({
appId: "cb5c93e3-027e-4516-bf87-24ec1252d0c8",
})
/* Usage:
<LoginWithGitHub oneGraphAuth={auth} onLogin={() => console.log("User has successfully logged into GitHub.")} />
*/
const LoginWithGitHub = ({ oneGraphAuth, onLogin }) =>
<button
onClick={async () => {
await oneGraphAuth.login("github")
const isLoggedIn = await oneGraphAuth.isLoggedIn("github")
isLoggedIn && onLogin()
}}
>
Log in with GitHub
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment