diff --git a/.gitignore b/.gitignore index 454c38f..d4fb8d7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ web-build/ # macOS .DS_Store +app.config.js diff --git a/App.tsx b/App.tsx index 7aced7c..7e12648 100644 --- a/App.tsx +++ b/App.tsx @@ -1,21 +1,41 @@ -import { StatusBar } from 'expo-status-bar'; -import React from 'react'; -import { StyleSheet, Text, View } from 'react-native'; +import * as React from "react"; +import * as WebBrowser from "expo-web-browser"; +import { makeRedirectUri, useAuthRequest } from "expo-auth-session"; +import { Button } from "react-native"; +import Constants from "expo-constants"; + +WebBrowser.maybeCompleteAuthSession(); + +// Endpoint +const discovery = { + authorizationEndpoint: "https://github.com/login/oauth/authorize", + tokenEndpoint: "https://github.com/login/oauth/access_token", + revocationEndpoint: `https://github.com/settings/connections/applications/${Constants.manifest?.extra?.githubOAuthClientID}`, +}; export default function App() { + const [request, response, promptAsync] = useAuthRequest( + { + clientId: Constants.manifest?.extra?.githubOAuthClientID, + redirectUri: Constants.manifest?.extra?.githubOAuthCallbackURL, + }, + discovery + ); + + React.useEffect(() => { + if (response?.type === "success") { + const { code } = response.params; + console.log(`success code: ${code}`); + } + }, [response]); + return ( - - Open up App.tsx to start working on your app! - - +