OTP implementation using firebase and laravel - firebase-authentication

How do i implement Firebase OTP verification for laravel api routes and test it using postman.
I am able to implement the same on the web routes but have no clue on how to do the same in the api route section.
Any pointer and tutorial will be much appreciated.
The flow i'm trying to reach is userdata -> mobile otp verification -> save user info to db

Related

React Native Authentication

I have my website in Angular and NodeJs(backend). Now I am developing the app with the same website functionality in React Native.
This is my authentication flow
Firebase phone(OTP) auth
Setting cookies and userId
Since browsers implement cookie storage, I don't have to manually store the session id
To get data/call the APIs, I use passport.js(req.isAuthenticated()) as middleware
I read articles on how to do the same steps, but I didn't get clear information. I want to follow the same approach in React Native APP(since our APIs are already defined and configured). Since I am using Axios, it would be great if I can get some insights on how to send withCredentials: true & some headers globally configured to all the APIs. Any articles on how to perform these would be great too.

React Native Google Authenticate with Django Allauth returns "Incorrect value" (iOS/Android)

I am trying to perform social authentication (with Google) using react native ios and android, with Django on the back end. Note, no firebase is involved here.
Problem Overview
React Native Google Signin on the front end returns an (i) access_token and (2) code when the user authenticates with google. Using django rest auth, we send a post request to the back end server and "non_field_errors: ["Incorrect value"] is returned
Plugins Used:
React Native Google Sigin
Django All Auth
Django Rest Auth
The process
Google Cloud Console Setup (OAuth 2.0 Client IDs):
3 Types are setup in Google Cloud Console
A) Web application (ClientId + Secrete)
B) Android (only ClientId)
C) iOS (only ClientId)
On the Front End (React Native Google Signin)
async componentDidMount () {
GoogleSignin.configure({
webClientId: 'ABC-123', (i.e. A above)
iosClientId: 'ABC-456', (i.e. C above)
});
}
On the Back End (Django Allauth)
1 model object is set up, Google, with A) Web application (ClientId + Secrete) as per google documentation
User Login via Front End
When the user authenticates with google in app on their phone, Android or iOS, a token and code is returned. Sending this via Django Rest Auth {access_token: 'cdeasdlkjla', code:'adkj'} returns "non_field_errors: ["Incorrect value"]
Thoughts!?
I found the problem, with the help of #Kapobajza response.
Django AllAuth Google Social Auth accepts 'access_token'
React Native Google Sigin's default is 'id_token'
Note that 'access_token' =/= 'id_token'
Therefore, there are two solutions:
Backend: Django AllAuth should support id_token. At the time of writing, it does not.
There is an open ticket here in the link below, which leads to a way to manually support it
https://github.com/pennersr/django-allauth/issues/1983
Or:
FrontEnd: React Native Google Sigin can produce an access token, with just a small step. It is outlined below, Step4
How to get accessToken of React Native GoogleSignIn?
Best solution is 2

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

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.

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!