React js web application with Laravel passport Oauth2 - reactjs

I have a backend admin panel created in Laravel 8, and i have installed passport security also. Admin frontend is working on vuejs by using laravel frontend scaffolding.
I have another one website in react js and one mobile application in React Native. The api to the web and mobile application is from laravel admin application. So what my doubt is, when i use external react js application what are the grand types should i use for authorization. And how will i segregate api routes for login user data and common data to the external react application.
Anyone can help me to get into the track.
Thanks in advance.

Related

How do I implement Single Sign on. Applications are written in Blazor App and React JS

I need to implement the Single Sign on with Azure AD B2C. One of our application is developed in Blazor and other is developed in React JS.
Once user logged in Blazor app and then come to React JS app, he should be directly logged in without entering the credentials.
Thanks
Multiple Blazor app are able to work with SSO, but not the React JS app.
If your requirement is only specific to Azure AD/ Microsoft SSO then you can use Microsoft Authentication Library for React (msal-react).The library will be useful for React or JS based client application to authenticate using Azure AD.
Refer this for more information-
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-react

Setup a hybrid structure of MVC and React App

I'm familiar with the .Net and React applications individually. What I want to do is to create a hybrid app of MVC and React for SaaS. Below are the details,
.NET MVC application for our website (can't create this in react as
it is a website and intended to use for google crawl, SEO, and all)
Once users log in using the MVC application LOGIN form, I want to redirect
them to ReactApp which is basically a portion after login
I already have a website built using MVC. Now want to load React application after successful login
Note: This needs to be run under the same domain. No redirection to sub-domain or so. Although, we can have an additional paths like /user
Questions:
Is it possible to traverse users between both applications?
Is it possible to manage the same session between the two?

Authentication of React native app with express js back end

I have developed Angular, express js web application with JWT authentication. Now I need to develop react native mobile app for the same purpose as a web application. How can I add authentication for react native app. should it need to use JWT for the react native app or are there any other authentication techniques for the mobile application. I'm new to react native as well as mobile app development. Give me some recommended guides for react native and express js back-end development. Both web application and mobile application has the same database implemented using MSSQL.
You can of course use the JWT strategy.
I suggest you to use the AsyncStorage to store your token or any other data.
https://reactnative.dev/docs/asyncstorage
For the authentication you could create an AuthenticationContext where to provide all the functions and logic you need for the authentication.
Inside the context you could have function to login and to logout, a function to store the user in the AsyncStorage, a function to remove the user from the AsyncStorage, a function to determine whether the user is authenticated and other logic according to your needs.

How to manage mobile and web authentication with Django Rest and react/react native?

We are in the process of setting up a project that requires mobile and web app authentication and were wondering if there are any best practices for implementation.
For the backend we are currently using django rest framework with a knox token authentication and for the web frontend react.js. For the future, there will be a mobile app in react native.
We want to set up the authentication now so that it supports the react native mobile app in the future. However, I have seen that Knox authentication does not work for mobile apps straight forward as it uses csrf token.
So I'm wondering if there are any best-practices for mobile app and web authentication that specifically feature good documentation, multi-device login and smooth extensibility of login options (fb, google etc) for the current setup drf and react.js/react native.
I'm grateful for any guiding hints.
AWS Cognito seems to be a solution to your problem:
Typically, your users get tokens via an external UI provided by amazon (not really customizable) or by calling the Auth API within your React UI.
Cognito sends access_token, id_token and refresh_token to your react app. You need to pass the access_token to your drf backend (similar to knox token authentication) and validate it again via amazon.
Check out the official docs for React, check out this tutorial for django (it helped me a lot!).

Laravel Authentication (With ReactJs)

This is made me new about how it works the authentication of laravel in the ReactJS
Hi I'm new in ReactJS, is their sample, or tutorial how to use the authentication login of laravel in the ReactJS.
I read in github other say use JSON web tokens (JWT)
Thanks.
Building an authentication flow with Laravel and React is similar to using any other framework like Nodejs. You just build the auth endpoints in Laravel and make REST calls to your endpoint from ReactJS.
But a quick google search will reveal multiple solutions to your problem. But the one that I think would be of most help: React-Laravel JWT Authentication Tutorial

Resources