Created
May 19, 2020 17:53
-
-
Save esneko/4aaa3d590a07048c5cc10c5ebcd5ea9d to your computer and use it in GitHub Desktop.
OneGraph Auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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