What will be re-direct URL of mobile app for smartsheet - react-native

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.

Related

Discord auth with react native frontend and express server backend

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

How to use best use Google/Facebook signin using expo AuthSession to authenticate with a custom backend API

I am working on creating an mobile app using Expo (managed workflow). I have a backend server which this app will connect to. The backend server has its own authentication with username and password and all other endpoints are protected based on a token that you would receive by signing in to the API using a /authenticate endpoint.
Now, I would like to add a 'Sign in with Google' feature to my app. From the Expo's AuthSession documentations, it looks like somehow the app can authenticate with Google. I want to use this identity to authenticate with my backend API.
I created a /api/auth/google endpoint in my API that uses passport google-oauth, redirects user to google and get authorization code sent to /api/auth/google/callback. I then use the authorization code to access Google's people API, to get the email to validate the user and respond back with a access token for my API if the Google sign in was successful. This works fine when using in a browser.
I want to do something similar for the react-native app. When I use the Google example in Expo's AuthSession, it gives me back a access_token. I have no idea how it gets an access_token because the app does not know my client secret. But still, I don't know how to use it to login to my API and get my API's token.
I have thought about using AuthSession to directly open my API's /api/auth/google, so it would redirect correctly and my backend can then send my API's token to the app. The problem with this is, when someone clicks on the 'Sign in with Google' button in the app, apple will tell you 'App name wants to use myapi.com to sign in' or something along those lines instead of Google.com. Additionally when I add more sign in options like Sign in with Facebook and Sign in with Something else, the user's phone will always say that the app wants to use myapi.com to sign in and then in turn be redirected to Google/Facebook or something else. I am not sure if this is allowed and would count as misleading the user and get rejected form the app store. I tried logging into some of the apps on my phone and clicking on 'Sign in with Google' tells the app is trying to sign in with Google.com and 'Sign in with Facebook' tells that the app is trying to sign in with Facebook.com correctly. But then I also know that the app eventually authenticates with its own API somehow. I don't know what is the right way to do that.
Can someone help? Thanks.

React Native - Nodejs Express Social Login

I have been pulling my hair to understand what is the method to implement facebook/google login for a react native mobile application which has a nodejs back end.
I currently have social login properly working for reactjs website, which is using passport.js.
In the website, clicking facebook/google login buttons calls my server API. From server API request is redirected to Facebook which provides a form for the client to login. Once the user is authenticated, Facebook shares the requested user info to node js server and the server returns the JWT to the mobile application.
How can I port this method to react-native mobile application?
Any help is highly appreciated!!

Auth0 Authentication API with React Native

I am currently developing a mobile app in react native and using Auth0 for user management. I am using my own login, signup and forgot password screens instead of their lock widget. I was able to implement passwordless sms and email by calling their authentication api as well as account linking by using their management api. However, I am having difficulty authenticating in a user with their email and password through the api once they already have an account. It seems to me that there should be a single endpoint for this in which you include the email and password in the body of the request. I was wondering if anyone could help me understand how to simply login users using auth0's api. Thanks in advance.
Take a look at this react native (embedded login custom UI) sample (slightly dated) - wrote it around 6 months ago, but it should offer you good insights - https://github.com/auth0-samples/react-native-embedded-login
Sign in logic is here
Feel free to leave questions below.
For anyone who is still looking there is this step by step on their website on how to login with password via API: https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-resource-owner-password-flow
And with this endpoint you can register a new account: https://auth0.com/docs/api/authentication#signup

React Native Okta SSO 403

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!