I am trying to build an SSO login flow on a React Native app using Okta's oauth 2.0 api.
Here is the flow that I am trying to achieve:
(1) webview renders login page from /oauth2/:authorizationServerId/v1/authorize?response_type=code&response_mode=query&client_id=&scope=&redirect_uri=___.
(2) user logs in.
(3) webview renders redirect_uri with authorization code in url.
(4) I extract authorization code and send it along with client id, client secret, and other necessary params to /oauth2/:authorizationServerId/v1/token.
(5) endpoint responds with accessToken.
I am able to get the accessToken through this process using postman and curl so I know that this works. I have also verified that this exact flow works on a Xamarin app.
However, when trying to hit the /oauth2/:authorizationServerId/v1/token route from my React Native app after getting the authorization code, I always get a 403 without an error message.
I am using fetch for my api calls and used the not-CRNA way of creating my app.
Has anyone ever come across this issue before? In general, has anyone been able to get this type of Okta flow to work with React Native?
At first I thought it was a CORS issue but followed the CORS test here and verified that this was not the case.
I also thought it was an issue with making a fetch request and rendering a webview at the same time. I built my own Okta sign-in page so I wouldn't have to use a webview and used this flow but got the same 403.
Any and all help on this would be greatly appreciated.
Thanks!
Related
I have an application that shares backend with a web. This application has basic email/password login that returns Access Token which is being sent as a header for any other requests. The application also has a screen that is a WebView which displays the web version of this app.
My problem is that I don't know how to share user session between RN app and the WebView. When the user logs in the application it should also log him in the WebView page and if the user logs out it should log him out the WebView aswell.
Is there any way, to inform the WebView that user has logged in and that he should be logged in in the WebView as well?
I tried sending the Authorization header in the WebView source but it doesn't work. https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#working-with-custom-headers-sessions-and-cookies
Any auth is based on a secret. First, you need to decide what is your secret, it can be a session identifier or jwt token. Then you can communicate between React Native -> Web and back Web -> React Native
follow this guide communicating-between-js-and-native and share your knowledge about this secret and use it for your requests.
Related to custom headers this will set the header on the first load, but not on subsequent page navigations.
In my react app i added a button that redirects to the login page url. In my backend login page i used passport.js to make discord oauth and then redirect to an callback page where i have a simple rendered page who said is logged in successfuly, now he can return to the app. After that, in my frontend i added a button where it sends a axios post request with credentials and it says its unauthorized, so in few steps i need to use the same cookie from the web page i logged and need to access that from my react app.
BTW. i already use cors in my backend and i watched some tutorials but cant find a solution for that. Thanks in advice
Can anybody tell me that is it necessary that tiktok webapp should be approved for getting access token cuz my app is under reviewed and when I go to authentication page for callback authorization after login it is showing error
I followed all the instructions that were given in there documentation but i am stucked at the call back authorization
The status of your app should be Live in production. They usually give you feedback if there are any issues and in case it's declined. You have to make fixes accordingly to get the API functionality to work.
The reviewal process shouldn't take longer than 3 working days.
Beginner programmer here. I am trying for third party app development from Smartsheet api in React Native. Just following OAuth flow which is mentioned here http://smartsheet-platform.github.io/api-docs/?javascript#third-party-app-development
Here is the request which i need to send "GET https://app.smartsheet.com/b/authorize"
And params with it are following:
response_type: 'code',
client_id: '1samp48lel5for68you',
redirect_uri: 'http://localhost:3000/callback' (But i don't know what will be for my React Native app.),
scope: 'CREATE_SHEETS WRITE_SHEETS',
So my question is what will be redirect_uri for my app ? If i use any dummy web callback uri it gives me error of invalid uri. I want to request for an Authorization Code from that api.
Please help me out i have already spent so many hours to solve this issue but in vain.
Thanks in advance.
Setting up an application for the Smartsheet OAuth flow requires providing an HTTPS URL for the APP redirect URL when registering the app. For this you can setup an OAuth server (using Node.js & Express possibly) to do all of the authentication work. Then your mobile app talks to that server to trigger the authentication process. This server could also be used to do all of the interaction with the Smartsheet API itself. Then your mobile app talks to this server to get the data it needs from Smartsheet.
I am not able to figure out how do I use facebook's client side authentication with Durandal.js. Can someone provide me with some example of something?
I tried to initialize facebook's authentication on view attached of my home view but that just doesn't work. It returns undefined user's name, although it launches facebook's login popup and closes it when I am logged in but it just doesn't returns me any response.
For Durandal authentication, check out: https://github.com/yagopv/DurandalAuth