Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
User authentication with ASP MVC and React

In C# and with claims it is easy to set up a login system. I am wondering how to correctly do it with React and C# as a back-end?

Do I have to send login and password from React's form with an xmlhttp post request and check if it exist? Should I then setup claims and then what? Send and ID as a JSON result back and save it to my local storage? This makes no sense to me since there are claims already. Or should I check if there are any claims on every refresh, and if there are, send back at least the ID to React's view?

Any ideas?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The common authentication for SPAs and REST backends nowadays is bearer token. See RFC 6750. A common extension on the bearer token is JWT (JSON Web tokens). The linked page has links to many JWT .Net libraries, like System.IdentityModel.Tokens.Jwt.

Your app should display a login form then do a REST POST on an authentication endpoint to obtain the JWT token. Then token can contain anything you wish, including IDs and claims. The next step is to make sure your SPA injects the token in every single request it makes, in order to be authenticated by the back end. This, of course, is entirely dependent on how your app interacts with the back end, since 'react' does not address that part. For example, for Redux see this.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!