This example has moved to examples/with-auth0
expo / auth0-example Goto Github PK
View Code? Open in Web Editor NEWThis example has moved
Home Page: https://github.com/expo/examples/tree/master/with-auth0
This example has moved
Home Page: https://github.com/expo/examples/tree/master/with-auth0
This example has moved to examples/with-auth0
Hi,
Could you update the SDK so snack can run it?
For some reason I'm not getting back a JWT token just an access token I have copied the example
I'm testing this out with Twitter. When I use the _loginWithAuth0() method I get navigated correctly to the Auth0 with the Twitter option and the email/password option. However, when I select Twitter I get an error in my simulator stating:
Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings.
and the logs show:
Object {
"errorCode": undefined,
"params": Object {
"error": "access_denied",
"error_description": "Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings",
"exp://localhost:19000/--/expo-auth-session": "",
},
"type": "success",
"url": "exp://localhost:19000/--/expo-auth-session#error=access_denied&error_description=Callback%20URL%20not%20approved%20for%20this%20client%20application.%20Approved%20callback%20URLs%20can%20be%20adjusted%20in%20your%20application%20settings",
}
However, if I use the _loginWithAuth0Twitter() method I simply get the same error above, nothing opens in the webview. I've tried setting up my Auth0 application callback URLS as such:
https://auth.expo.io/@USERNAME/SLUG,
https://auth.expo.io/@USERNAME/SLUG/callback,
expo://APPLICATION.auth0.com/ios/SLUG/callback,
exp://localhost:19000/--/expo-auth-session,
exp://localhost:19000/--/expo-auth-session/callback
and my Twitter App callback URLs are set as:
https://auth.expo.io/@USERNAME/SLUG,
https://APPLICATION.auth0.com
Can someone take a look at their callback URLs and give me a suggestion please. Thanks!
I tried to make it work using facebook; its crashing and doenst provide id_token instead i am getting access_token in the response url :
yo: exp://x.....exp.direct/+/redirect#access_token=BfHzspLFaOiXXXX&expires_in=7200&scope=openid&token_type=Bearer&state=exp%3A%2F%2Fx........exp.direct%2F%2B%2Fredirect
7:00:42 PM
Object {
"access_token": "BfHzspLFaOiXXXX",
"expires_in": "7200",
"scope": "openid",
"state": "exp%3A%2F%2Fxjxxxxx........exp.direct%2F%2B%2Fredirect",
"token_type": "Bearer",
}
7:00:43 PM
Possible Unhandled Promise Rejection (id: 0):
[InvalidTokenError: Invalid token specified: undefined is not an object (evaluating 'str.replace')]
Hi,
We are trying to use auth0 and Expo's AuthSession to authenticate users in a browser and then direct them back to the application with the token, etc..
Right now when using
exp start
and testing on iOS and Android through expo app, we see the auth0 lock screen and then it redirects back to our app perfectly.
But after building standalone ipa and apk files from the auth0 lock screen success it redirect
https://expo.io/@myuser/{project-slug}/+expo-auth-session#access_token=[TOKEN]&scope=openid&expires_in=7200&token_type=Bearer&state=[somevalue]
The page shows "404. Looks like the page you are looking for does not exist. Here are some links to bring you back to Expo", and there are 3 options: return home, log in to your account, create an account.
We expect the app to actually close the browser with the access token. Any help would be really great. Thanks
Our project is configured using
"expo": "^21.0.2" "react": "^16.0.0-alpha.12" "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
We are using the following commands to generate apk and ipa.
exp build:android
exp build:ios
In the README is mentioned
In the application settings, you must add the redirect URL for your Expo application that is coming from the AuthSession module (built-in in Expo).
But what are the specific settings that must be updated with the expo auth URL? The allowed callback URLs? The Application Login URI?
Currently whenever I click on the button to login it redirects me somewhere else and then back to the application, the Auth0 login doesn't even show up, and this is the error I get in the Expo panel:
Info
21:37
Redirect URL: https://auth.expo.io/@oxyrus/auth0-example
Info
21:37
Authentication response Object {
"errorCode": "cookies-disabled",
"params": Object {},
"type": "error",
"url": "exp://8n-nth.oxyrus.auth0-example.exp.direct:80/--/expo-auth-session?errorCode=cookies-disabled",
}
If I use just the example, straight from a clone, it fails. At least when I tried with Google and Facebook. From what I could tell, the response wasn't encoded, but just a JWT.
To get the example to work, I had to add/change response_type, scope, nonce, audience
to the startAsync
call.
Can someone confirm this or why and if so I will submit a PR.
My modified piece
_loginWithAuth0 = async () => {
const redirectUrl = AuthSession.getRedirectUrl();
console.log(`Redirect URL (add this to Auth0): ${redirectUrl}`);
const result = await AuthSession.startAsync({
authUrl: `${auth0Domain}/authorize` + toQueryString({
client_id: auth0ClientId,
response_type: 'id_token',
scope: 'openid email profile',
audience: 'https://example.auth0.com/userinfo',
nonce: await this.getNonce(),
redirect_uri: redirectUrl,
}),
});
Hi guys.
Please clarify how to setup callback url properly for multiple users.
In the provided auth0 expo example callback url is generated this way:
const redirectUrl = AuthSession.getRedirectUrl();
And it gives a callback in the format:
https://auth.expo.io/@your-username/your-expo-app-slug
In my case it is:
https://auth.expo.io/@boba111/awesomeapp
And it works fine but only for a single user boba111
.
In case I use react-native without expo I don't have this issue because callback url on the auth0 website is configured this way:
{PRODUCT_BUNDLE_IDENTIFIER}://darmikon.eu.auth0.com/ios/{PRODUCT_BUNDLE_IDENTIFIER}/callback
In my case it looks like this
com.awesomeapp://boba111.eu.auth0.com/ios/com.awesomeapp/callback
So how to setup callback url so that auth0 works for production for any number of users?
Is any way to setup kind of wildcard callback url for expo + auth0?
Thanks in advance
Hi guys. I'm not having any luck getting this to work properly with Android 7.1.1.
If you want to see it, I have a video taken from my phone, not an emulator. It's weird, you can kind of see it dismiss something but then the browser remains in the foreground. Let me know what else I can provide to to help troubleshoot.
You can hit me up in the Exponent Slack via DM if you want the video. Can't post here. :/
Hi,
Thanks for this example. I'm struggling with logout: I've tried this, but without success:
await WebBrowser.openBrowserAsync(
"https://goferworkondemand.eu.auth0.com/v2/logout",
)
How should I logout my user? Thanks for your help.
Hey there, I'd like to request input or discussion on using Auth0's PKCE flow that allows for a refresh token in addition to the standard id token and access token.
The standard Implicit flow works fine, as demonstrated in the example code. This flow is important in mobile applications, and example here would be extremely valuable and helpful for those using the Expo flavor of React Native and integrating with Auth0. Their documentation makes use of the Node crypto
library, which appears to be unavailable in a React Native app.
I'm trying to follow the guide but you don't give guidance on if the app isn't published as from here: (https://docs.expo.io/versions/latest/workflow/linking#expolinking-module)
Should the local url look something like exp://LOCAL_IP:19000? This is what Linking.makeUrl('/') gave me.
I can't get it looking like exp://wg-qka.community.app.exp.direct:80 taken from the linking docs
LOVE this tutorial, it was super easy to follow and worked perfectly as a template for my own app's login page :)
Question though... why do we have to use the exp://...direct
address for the redirect? Could (in dev mode) we set it to localhost?
My flow is:
Click Login -> Popup WebView with my server's login -> Hit callback url via Linking eventListener
There is no id_token in the response when using this example. How do we fix this?
I opened a branch to upgrade expo to 33.0.0 but can't push to a branch. is it because I cloned with Https?
I tried to clone by ssh but:
Cloning into 'auth0-example'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Can you add permissions?
I'm trying to dispatch this function:
export const login = () => async (dispatch) => {
let res = await AuthSession.startAsync({
authUrl:
'https://creato.eu.auth0.com/authorize' +
toQueryString({
connection: 'linkedin',
client_id: 'myId',
response_type: 'token',
scope: 'openid name',
redirect_uri: 'https://auth.expo.io/@alexbidiuk/binder',
}),
});
console.warn(res);
};
But all time receive this errors:
Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not an object (evaluating '_expo.AuthSession.startAsync')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.