-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bannzai/imp/first
Implement first for GitHub OAuth
- Loading branch information
Showing
5 changed files
with
160 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ web-build/ | |
|
||
# macOS | ||
.DS_Store | ||
app.config.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<View style={styles.container}> | ||
<Text>Open up App.tsx to start working on your app!</Text> | ||
<StatusBar style="auto" /> | ||
</View> | ||
<Button | ||
disabled={!request} | ||
title="Login" | ||
onPress={() => { | ||
promptAsync(); | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#fff', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
secret: | ||
echo $(APP_CONFIG_JS) | base64 -D > app.config.js | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1920,7 +1920,7 @@ balanced-match@^1.0.0: | |
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" | ||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== | ||
|
||
base64-js@^1.1.2, base64-js@^1.2.3, base64-js@^1.5.1: | ||
base64-js@^1.1.2, base64-js@^1.2.3, base64-js@^1.3.0, base64-js@^1.5.1: | ||
version "1.5.1" | ||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" | ||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== | ||
|
@@ -2276,6 +2276,13 @@ commondir@^1.0.1: | |
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" | ||
integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= | ||
|
||
compare-urls@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/compare-urls/-/compare-urls-2.0.0.tgz#9b378c4abd43980a8700fffec9afb85de4df9075" | ||
integrity sha512-eCJcWn2OYFEIqbm70ta7LQowJOOZZqq1a2YbbFCFI1uwSvj+TWMwXVn7vPR1ceFNcAIt5RSTDbwdlX82gYLTkA== | ||
dependencies: | ||
normalize-url "^2.0.1" | ||
|
||
compare-versions@^3.4.0: | ||
version "3.6.0" | ||
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62" | ||
|
@@ -2667,6 +2674,18 @@ expo-asset@~8.3.3: | |
path-browserify "^1.0.0" | ||
url-parse "^1.4.4" | ||
|
||
expo-auth-session@~3.3.1: | ||
version "3.3.1" | ||
resolved "https://registry.yarnpkg.com/expo-auth-session/-/expo-auth-session-3.3.1.tgz#afac1cc23513529eccdfd52b66ddac8546d13611" | ||
integrity sha512-o6MwM0V/oRMxBCUOuk3XYuDBtFx9ELEbWkQ5doy7nFEZpB3DbhGF+uYKBC3d3VoZsFGBEabrm5FGwpZNd0PjzQ== | ||
dependencies: | ||
expo-constants "~11.0.1" | ||
expo-crypto "~9.2.0" | ||
expo-linking "~2.3.1" | ||
expo-web-browser "~9.2.0" | ||
invariant "^2.2.4" | ||
qs "6.9.1" | ||
|
||
expo-constants@~11.0.1: | ||
version "11.0.1" | ||
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-11.0.1.tgz#8a33d9702d03289ab68d6de2bbeb2bbc9654734c" | ||
|
@@ -2676,6 +2695,11 @@ expo-constants@~11.0.1: | |
expo-modules-core "~0.2.0" | ||
uuid "^3.3.2" | ||
|
||
expo-crypto@~9.2.0: | ||
version "9.2.0" | ||
resolved "https://registry.yarnpkg.com/expo-crypto/-/expo-crypto-9.2.0.tgz#5d124539836767c019297816f050b8bb73056297" | ||
integrity sha512-jc9E7jHlOT8fYs64DIsSOdnLtxtIK1pV78O/nBamPwKdGrvFSNqMSFndxyVSuEimBNoPPNRwN+4Pb4W1RRltJA== | ||
|
||
expo-error-recovery@~2.2.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/expo-error-recovery/-/expo-error-recovery-2.2.0.tgz#89e5494d97347530dd53cd817d7ac63f07bf8de0" | ||
|
@@ -2703,6 +2727,16 @@ expo-keep-awake@~9.2.0: | |
resolved "https://registry.yarnpkg.com/expo-keep-awake/-/expo-keep-awake-9.2.0.tgz#9cbdcc8264c943ef29a58326236cd34267e98f43" | ||
integrity sha512-R5jAx5j3MqrhKFB307FBpaHtYSYeVIFX/rVforBF5inKonYjXRWVhjGoBjolF4geAryNamC3NKhMfxyaaB0W6Q== | ||
|
||
expo-linking@~2.3.1: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/expo-linking/-/expo-linking-2.3.1.tgz#477af2bcc156a7f8ba9961c7b3f4aa103e18db98" | ||
integrity sha512-c2O23OdWOHaIRAKhveZ/PhdNq8DUx3995GQKtnz0WK7fuAmEYM8GU/F6KIUXV0QGEkRKB7drDb8Rk2JYi39Gag== | ||
dependencies: | ||
expo-constants "~11.0.1" | ||
invariant "^2.2.4" | ||
qs "^6.5.0" | ||
url-parse "^1.4.4" | ||
|
||
expo-modules-autolinking@^0.0.3: | ||
version "0.0.3" | ||
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-0.0.3.tgz#45ba8cb1798f9339347ae35e96e9cc70eafb3727" | ||
|
@@ -2719,11 +2753,25 @@ expo-modules-core@~0.2.0: | |
resolved "https://registry.yarnpkg.com/expo-modules-core/-/expo-modules-core-0.2.0.tgz#68e5b6e53d0afbf8d131578831aed657589a2d42" | ||
integrity sha512-inpfZ5X/BaTtbj2wG9PA9AC0MN8VyId6KSRlVuEg7+ziurHBy/kKDFxpOddUokhwiln2uhoYPSStJjR/tKypdw== | ||
|
||
expo-random@~11.2.0: | ||
version "11.2.0" | ||
resolved "https://registry.yarnpkg.com/expo-random/-/expo-random-11.2.0.tgz#245ff64c1d980fb45caa84e92ae396af0fd3c88e" | ||
integrity sha512-kgBJBB02iCX/kpoTHN57V7b4hWOCj4eACIQDl7bN94lycUcZu62T00P/rVZIcE/29x0GAi+Pw5ZWj0NlqBsMQQ== | ||
dependencies: | ||
base64-js "^1.3.0" | ||
|
||
expo-status-bar@~1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.0.4.tgz#d8a4c4418b5868c1606969b12bdee85b6fa7d8a4" | ||
integrity sha512-s7nc496D/Zn1NGiMJ5wu6HyIdXxbgGtmZZtbHm7rpbcmLdf28GmMSNHDx7M0t00BMhky7VAurTCUo+BJs8ugsw== | ||
|
||
expo-web-browser@~9.2.0: | ||
version "9.2.0" | ||
resolved "https://registry.yarnpkg.com/expo-web-browser/-/expo-web-browser-9.2.0.tgz#34c1355552c4c6eaae515340a0761939a9bf6152" | ||
integrity sha512-Gy9tkIw/JplfiTiOR/pdEbLdyuzeQBYFuU27TXSfLOn/tDRcOghOcJ+vNH2FX3iZqReBHMJEINjcWxpOpOvpFw== | ||
dependencies: | ||
compare-urls "^2.0.0" | ||
|
||
expo@~42.0.1: | ||
version "42.0.3" | ||
resolved "https://registry.yarnpkg.com/expo/-/expo-42.0.3.tgz#b92278bcac5c42def707cd1bab8ea2ef077f3120" | ||
|
@@ -3421,6 +3469,11 @@ is-obj@^1.0.0: | |
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" | ||
integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= | ||
|
||
is-plain-obj@^1.0.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" | ||
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= | ||
|
||
is-plain-object@^2.0.3, is-plain-object@^2.0.4: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" | ||
|
@@ -4286,6 +4339,15 @@ normalize-path@^2.1.1: | |
dependencies: | ||
remove-trailing-separator "^1.0.1" | ||
|
||
normalize-url@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-2.0.1.tgz#835a9da1551fa26f70e92329069a23aa6574d7e6" | ||
integrity sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw== | ||
dependencies: | ||
prepend-http "^2.0.0" | ||
query-string "^5.0.1" | ||
sort-keys "^2.0.0" | ||
|
||
npm-run-path@^2.0.0: | ||
version "2.0.2" | ||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" | ||
|
@@ -4317,6 +4379,11 @@ object-copy@^0.1.0: | |
define-property "^0.2.5" | ||
kind-of "^3.0.3" | ||
|
||
object-inspect@^1.9.0: | ||
version "1.11.0" | ||
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" | ||
integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== | ||
|
||
object-keys@^1.0.12, object-keys@^1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" | ||
|
@@ -4574,6 +4641,11 @@ posix-character-classes@^0.1.0: | |
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" | ||
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= | ||
|
||
prepend-http@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" | ||
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= | ||
|
||
pretty-format@^24.9.0: | ||
version "24.9.0" | ||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" | ||
|
@@ -4645,6 +4717,27 @@ pump@^3.0.0: | |
end-of-stream "^1.1.0" | ||
once "^1.3.1" | ||
|
||
[email protected]: | ||
version "6.9.1" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.1.tgz#20082c65cb78223635ab1a9eaca8875a29bf8ec9" | ||
integrity sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA== | ||
|
||
qs@^6.5.0: | ||
version "6.10.1" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a" | ||
integrity sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg== | ||
dependencies: | ||
side-channel "^1.0.4" | ||
|
||
query-string@^5.0.1: | ||
version "5.1.1" | ||
resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" | ||
integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== | ||
dependencies: | ||
decode-uri-component "^0.2.0" | ||
object-assign "^4.1.0" | ||
strict-uri-encode "^1.0.0" | ||
|
||
querystringify@^2.1.1: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" | ||
|
@@ -5115,6 +5208,15 @@ shell-quote@^1.6.1: | |
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" | ||
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== | ||
|
||
side-channel@^1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" | ||
integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== | ||
dependencies: | ||
call-bind "^1.0.0" | ||
get-intrinsic "^1.0.2" | ||
object-inspect "^1.9.0" | ||
|
||
signal-exit@^3.0.0, signal-exit@^3.0.2: | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" | ||
|
@@ -5183,6 +5285,13 @@ snapdragon@^0.8.1: | |
source-map-resolve "^0.5.0" | ||
use "^3.1.0" | ||
|
||
sort-keys@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" | ||
integrity sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg= | ||
dependencies: | ||
is-plain-obj "^1.0.0" | ||
|
||
source-map-resolve@^0.5.0: | ||
version "0.5.3" | ||
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" | ||
|
@@ -5271,6 +5380,11 @@ stream-buffers@~2.2.0: | |
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4" | ||
integrity sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ= | ||
|
||
strict-uri-encode@^1.0.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" | ||
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= | ||
|
||
string-width@^2.1.0: | ||
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" | ||
|