Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:03:16+00:00 2026-06-15T03:03:16+00:00

I am building a single-page-application with a passport local authentication. The user is authenticated

  • 0

I am building a single-page-application with a passport local authentication.
The user is authenticated and returned within app.post "/login"
After the userobject is returned I save it in Chaplin.mediator.user (like seen in the facebook-example). As long as I don’t change the URL manually everything works fine, but when I change the URL and hit enter, the application gets loaded again however with a different route –> no user in the front end.

What I am doing right now is everytime I change the route manually I send a request to the server and ask for the user in req.user. After receiving the user the application continues its workflow. It works but I don’t think this is how it’s meant to be. If you don’t wait for the response you end up having no user object although you are logged in.

How can I solve this problem?

EDIT: I ended up saving the user in a seperate cookie.
This is how I save the user:

  $.cookie.json = true;
  $.cookie 'user', user.toJSON()

And this is how I extract the user after the page was loaded:

  userCookie = $.cookie 'user'
  if userCookie?
    mediator.user = new Model JSON.parse userCookie

You need the jquery-cookie plugin to make it work. Don’t forget to delete the cookie if the user logs out. And of course I am still open to other ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:03:17+00:00Added an answer on June 15, 2026 at 3:03 am

    You should store the user (aka the session) locally. When the Backbone application loads, you should then route the user to the correct place if they in fact are already logged in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a single-page application. At the moment, I also have several independent pages
I’m building an MVC3 application with form authentication and a single hierarchical entity. The
I'm building a single page, offline html5 web application using jquery mobile, backbone, underscore
I'm building a single page app with Backbone and Requirejs. For now I've been
I'm building a single page application with asp.net net mvc4 and javascript. My javascript
I am building an HTML5 single page app, and I want to allow the
I am building a single-page web application and I've been looking for a library
I am building a single page web application and one the requirements are jQuery,
I have been building a single page app using requireJS and so far loving
I'm building a single-page questionnaire app and I'm not sure what is the correct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.