Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/00-Login/metro-rea…
Browse files Browse the repository at this point in the history
…ct-native-babel-preset-0.77.0
  • Loading branch information
poovamraj authored Sep 18, 2023
2 parents 90dea0b + a1599e7 commit b81b2cd
Show file tree
Hide file tree
Showing 131 changed files with 25,109 additions and 3,070 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ buck-out/
*.jsbundle

# CocoaPods
/ios/Pods/
/ios/Pods/
00-Login/auth0-configuration.js
00-Login-Hooks/auth0-configuration.js
3 changes: 3 additions & 0 deletions 00-Login-Expo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ buck-out/
web-build/
dist/

ios
android

# @end expo-cli
10 changes: 7 additions & 3 deletions 00-Login-Expo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {useAuth0, Auth0Provider} from 'react-native-auth0';
import config from './auth0-configuration';

const Home = () => {
const {authorize, clearSession, user, error, getCredentials} = useAuth0();
const {authorize, clearSession, user, error, getCredentials, isLoading} = useAuth0();

const onLogin = async () => {
try {
await authorize({scope: 'openid profile email'}, {customScheme: 'auth0.com.auth0samples'});
await authorize();
let credentials = await getCredentials();
Alert.alert('AccessToken: ' + credentials.accessToken);
} catch (e) {
Expand All @@ -20,12 +20,16 @@ const Home = () => {

const onLogout = async () => {
try {
await clearSession({customScheme: 'auth0.com.auth0samples'});
await clearSession();
} catch (e) {
console.log('Log out cancelled');
}
};

if (isLoading) {
return <View style={styles.container}><Text>Loading</Text></View>;
}

return (
<View style={styles.container}>
<Text style={styles.header}> Auth0Sample - Login </Text>
Expand Down
10 changes: 4 additions & 6 deletions 00-Login-Expo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Open the `app.json` file and locate the following plugin configuration:
[
"react-native-auth0",
{
"domain": "{DOMAIN}",
"customScheme": "auth0.com.auth0samples"
"domain": "{DOMAIN}"

}
]
Expand All @@ -39,8 +38,7 @@ Replace `{DOMAIN}` with your Auth0 domain value. If you have `samples.auth0.com`
[
"react-native-auth0",
{
"domain": "samples.auth0.com",
"customScheme": "auth0.com.auth0samples"
"domain": "samples.auth0.com"
}
]
]
Expand All @@ -55,8 +53,8 @@ Replace `{DOMAIN}` with your Auth0 domain value. If you have `samples.auth0.com`
5. In the **Allowed Callback URLs** field, paste in the text below and replace `YOUR_DOMAIN` with the **Domain** from above. These URLs are required for the authentication result to be redirected from the browser to the app:

```
auth0.com.auth0samples://YOUR_DOMAIN/ios/com.auth0samples/callback,
auth0.com.auth0samples://YOUR_DOMAIN/android/com.auth0samples/callback
com.auth0samples.auth0://YOUR_DOMAIN/ios/com.auth0samples/callback,
com.auth0samples.auth0://YOUR_DOMAIN/android/com.auth0samples/callback
```

6. Add the same values to the **Allowed Logout URLs** field as well. These are required for the browser to redirect back to the app after the user logs out.
Expand Down
3 changes: 1 addition & 2 deletions 00-Login-Expo/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
[
"react-native-auth0",
{
"domain": "{DOMAIN}",
"customScheme": "auth0.com.auth0samples"
"domain": "{DOMAIN}"
}
]
],
Expand Down
10 changes: 5 additions & 5 deletions 00-Login-Expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"web": "expo start --web"
},
"dependencies": {
"expo": "~46.0.9",
"expo": "~48.0.18",
"expo-splash-screen": "~0.18.2",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-native": "0.69.5",
"react-native-auth0": "^2.16.0",
"expo-splash-screen": "~0.16.2",
"react": "18.2.0",
"react-dom": "18.0.0",
"react-native": "0.71.8",
"react-native-auth0": "^3.0.0",
"react-native-web": "~0.18.7"
},
"devDependencies": {
Expand Down
7,201 changes: 7,201 additions & 0 deletions 00-Login-Expo/yarn.lock

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions 00-Login-Hooks/.buckconfig

This file was deleted.

2 changes: 2 additions & 0 deletions 00-Login-Hooks/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
3 changes: 0 additions & 3 deletions 00-Login-Hooks/.editorconfig

This file was deleted.

2 changes: 1 addition & 1 deletion 00-Login-Hooks/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
extends: '@react-native',
};
67 changes: 0 additions & 67 deletions 00-Login-Hooks/.flowconfig

This file was deleted.

3 changes: 0 additions & 3 deletions 00-Login-Hooks/.gitattributes

This file was deleted.

27 changes: 13 additions & 14 deletions 00-Login-Hooks/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -29,20 +30,15 @@ build/
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
npm-debug.log
yarn-error.log
package-lock.json
yarn.lock

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
Expand All @@ -51,17 +47,20 @@ buck-out/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/ios/Podfile.lock
/vendor/bundle/

# Auth0 configuration file
app/auth0-configuration.js
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
2 changes: 1 addition & 1 deletion 00-Login-Hooks/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
17 changes: 11 additions & 6 deletions 00-Login-Hooks/app/App.js → 00-Login-Hooks/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@ import {useAuth0, Auth0Provider} from 'react-native-auth0';
import config from './auth0-configuration';

const Home = () => {
const {authorize, clearSession, user, getCredentials, error} = useAuth0();
const {authorize, clearSession, user, getCredentials, error, isLoading} = useAuth0();

const onLogin = async () => {
await authorize({scope: 'openid profile email'});
const {accessToken} = await getCredentials();
Alert.alert('AccessToken: ' + accessToken);
await authorize({}, {});
const credentials = await getCredentials();
Alert.alert('AccessToken: ' + credentials?.accessToken);
};

const loggedIn = user !== undefined && user !== null;

const onLogout = async () => {
await clearSession({federated: true}, {localStorageOnly: false});
await clearSession({}, {});
};


if (isLoading) {
return <View style={styles.container}><Text>Loading</Text></View>;
}

return (
<View style={styles.container}>
<Text style={styles.header}> Auth0Sample - Login </Text>
Expand Down Expand Up @@ -67,4 +72,4 @@ const styles = StyleSheet.create({
}
});

export default App;
export default App;
6 changes: 6 additions & 0 deletions 00-Login-Hooks/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.12'
Loading

0 comments on commit b81b2cd

Please sign in to comment.