Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Ionic auth with express and mongoose

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 621
    Answer it

    Hi! I'm trying to develop an application.But i'm a little bit confused about auth.I've seen more examples from github but their code are realy difficult and it's very hard to understand it .I need if it's possible,a small working example to understand how to work.Only a authentication and redirection to a home page.I want to use mongoose and express as backend and ionic for client.I will apreciate any help or advice!Thanks

 1 Answer(s)

  • To authenticate a user first you need to save the credentials to DB. When user login with valid credential then create a token and save this token to userSession collection into DB also you need to create session that store this token with user details.

    For every request to API made by the user you need to sent this token along with the data. At the API end first validate the token. To validate token make a DB query on userSession collection. If the token is exist on collection perform further steps otherwise sent authentication fail response and redirect to sign in page.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: