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 8665353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:27:41+00:00 2026-06-12T17:27:41+00:00

Working on my first EmberJS app. The entire app requires that a user be

  • 0

Working on my first EmberJS app. The entire app requires that a user be logged in. I’m trying to wrap my head around the best way to enforce that a user is logged in now (when the page is initially loaded) and in the future (when user is logged out and there is no refresh).

I have the user authentication hooks handled – right now I have an ember-data model and associated store that connects that handles authorizing a user and creating a user “session” (using sessionStorage).

What I don’t know how to do is enforce that a user is authenticated when transitioning across routes, including the initial transition in the root route. Where do I put this logic? If I have an authentication statemanager, how do I hook that in to the routes? Should I have an auth route that is outside of the root routes?

Note: let me know if this question is poorly worded or I need to explain anything better, I will be glad to do so.

Edit:
I ended up doing something that I consider a little more ember-esque, albeit possibly a messy implementation. I have an auth statemanager that stores the current user’s authentication key, as well as the current state.

Whenever something needs authentication, it simply asks the authmanager for it and passes a callback function to run with the authentication key. If the user isn’t logged in, it pulls up a login form, holding off the callback function until the user logs in.

Here’s some select portions of the code I’m using. Needs cleaning up, and I left out some stuff. http://gist.github.com/3741751

  • 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-12T17:27:42+00:00Added an answer on June 12, 2026 at 5:27 pm

    If you need to perform a check before initial state transition, there is a special function on the Ember.Application class called deferReadiness(). The comment from the source code:

    By default, the router will begin trying to translate the current URL into
    application state once the browser emits the DOMContentReady event. If you
    need to defer routing, you can call the application’s deferReadiness() method.
    Once routing can begin, call the advanceReadiness() method.

    Note that at the time of writing this function is available only in ember-latest

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

Sidebar

Related Questions

First time working with JSON in Rails and trying to figure out something which
I'm, currently working my first project in .NET 4.0 and it requires several thousand
I'm trying to design a system of chaining constructors in a way that I
I am new to wpf and i am working on first application i have
For some weird reason, the codes below are first working, then website is redirecting
Working on my first Rails project, I used Ryan Bates' Nifty-Generators to create the
Am working with my first storyboard application and am having a problem. When I
Currently working for the first time with JSON and with little experience of jQuery.
I working on my first ASP.net MVC project and and i got some problems
I'm working on my first programming assignment for Java and I had another question.

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.