This message was deleted.
# general
m
This message was deleted.
p
Hi @wonderful-journalist-69737 Ory Identities issue session cookies (browser applications) and session tokens (native applications). You can work with Ory OAuth for third party flows and single sign on, but I would recommend starting with Ory Identities. Please check out this guide for migrating from Auth0. https://www.ory.sh/docs/migrate-to-ory/migrate-from-auth0 To get started, I would use the Ory Account Experience to setup the project. It's the easiest to get started and then gradually adopt a custom UI. https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-overview
w
Hi @proud-plumber-24205, thanks for the response! I have tested the examples you have in your repositories and everything is working fine (great work there!). We got the session token in web and react-native. After that we created the Oauth2 provider in the dashboard and connect it with react-oidc-context to have the access token and similar flow as we had. What I would like to do is to do is the same with react-native. Is there any way to have the same flow in react-native ? The idea is to have the very few changes in our backend, and similar flow in react-native, PWA and web.
p
in native apps you would still need to open a webview to complete an OAuth authorization code flow (https://www.ory.sh/docs/oauth2-oidc/authorization-code-flow)
since it is a web based protocol.
I think maybe you should reconsider using OAuth for first party login and rather use session tokens / cookies. They are easier to implement and do not require webviews in native apps.
w
I should open the WebView and use it with /UI/login if I am using the one that Oauth2 provide, right? The thing with that is that I can not add the "com.myapp" redirect in the console of ory. It is not accepted as it is not a http/https.
Related to the part of sessions tokens/ cookies, is there any way to, after the login, convert that to an access token?
p
I should open the WebView and use it with /UI/login
no, you need to do an oauth flow to Ory inside the webview and this will eventually redirect you to the /ui/login page automatically. Once the user has completed the login and consent flow it will take you back to the app (the "client"). https://www.ory.sh/docs/oauth2-oidc/authorization-code-flow#mobilenative-and-public-client-with-pkce-and-custom-redirect-scheme
Related to the part of sessions tokens/ cookies, is there any way to, after the login, convert that to an access token?
No, but we are working on adding JWT support for Identity sessions.
w
Thanks for the quick reply! Yeah... I tried that, but that redirects me to /UI/welcome... And if I try it manually, it says that the URL that I add, in the example would be
<myapp://callback|myapp://callback>
, is not in the redirects in the Ory console ... And the console do no allow me to add it.
p
The redirect settings here are for the identities api
not for oauth
redirect uris are part of the client
w
Oh... I see... thanks for the patience and the help... So the problem that I am having a link like this =>
Copy code
<https://gracious-jang-c7xt3nfil6.projects.oryapis.com/oauth2/auth?code_challenge=MUiLGnyJzD-Z5Vfq4NLxM3PaW9-6xhUbnCPN9sSa92E&code_challenge_method=S256&redirect_uri=com.juanbevilacqua.AwesomeProject%3A%2F%2F&client_id=0450c334-3c01-4692-9407-40793cd025ec&response_type=code&state=h1aeC7jPrJ&scope=openid%20profile%20email%20offline_access>
but it is no redirecting me correctly to /UI/login but to /UI/welcome, and there I get stuck. I mean... The URL is created successfully but when the browser is open, this is not working as expected.
p
Is this on the initial request to the login flow or after you have signed in?
w
Initial request
p
can you check the browser request history? the URL query parameters usually include error messages if Ory OAuth was incorrectly configured or if the request is missing some parameter.
w
I couldn't find any error there.. just the redirect ... Any idea how I can fix this ? 🤔
p
I wonder if the cookies are set correctly for the flow to continue to the login page. The OAuth flow sets a csrf cookie in the request to the Identity login. Is the login page also on the account experience under the project url? or did you setup a custom ui / custom domain?
Also make sure the redirect_uri used is in the oauth allow list https://www.ory.sh/docs/hydra/debug#redirect-url-isnt-whitelisted and the scopes requested are correct