heartsentwined / ember-auth-rails-demo

rails + devise + ember-auth demo site
121 stars 16 forks source link

When do you expect this will be brought up to 5.0? #4

Closed ryw closed 11 years ago

ryw commented 11 years ago

@heartsentwined thanks so much for knocking out the "big refactor" of ember-auth. As an Ember noob, I'm struggling to adapt code I got from https://github.com/joscas/base_app — in particular how to fix first line of this: https://github.com/joscas/base_app/blob/master/app/assets/javascripts/controllers/sign_in_controller.js

Will the code of this demo app change a lot, based on v5.0 of ember-auth?

heartsentwined commented 11 years ago

In that case, v5.0 removed the boilerplate in v4.0 and lower, i.e.

However, if you are starting out, I suggest that you do not try to adapt from another app. joscas' app is actually quite good, but it includes more than basic Getting Started material. In particular, it has implemented semi-advanced manual use of transactions, but for starters the model lifecycle callbacks would be sufficient.

The docs themselves would actually generate the code that you need for ember-auth. I am also updating this demo to v5.0 - I'll let you know when I'm done.

heartsentwined commented 11 years ago

By the way, joscas himself is also doing the upgrade to v5.0, you might want to get in touch with him directly for advice if you are basing off his app.

heartsentwined commented 11 years ago

As for the code of this demo app, only the auth parts will change. If memory serves me correctly, the tutorial should still be valid all the way up to Ember setup, the next chapter would be Auth UI, where changes would be needed.

heartsentwined commented 11 years ago

Demo / tutorial updated to 5.x / 6.x.

ryw commented 11 years ago

Thanks for updating this @heartsentwined — the use case that I'm still struggling with is when I have a "secret route" that extends App.Auth.AuthRedirectable.

I'd like to be able to load the model when refreshed, but the complication is that the user might not be signedIn so no token, and 401 Unauthorized error happens loading the model data.

So I see code in base_app to transitionTo the current route, but transitionTo requires a model object passed to it, but I didn't get the model object due to the 401 Unauth problem :)

I'd love to see you drop a resource into this demo app that requires user be signedIn and calls the backend api correctly on browser load.

heartsentwined commented 11 years ago

Thanks for the feedback @ryw, this is indeed a thorny spot at the current implementation. I'm trying to figure out how to best implement this in ember-auth without incurring too much blocking overhead due to synchronous loading. I'll update both ember-auth and this demo when I got a good solution.

heartsentwined commented 11 years ago

Reopened as enhancement.

heartsentwined commented 11 years ago

Update: ember has got a new router, which is heavily relevant to authenticated-backed apps. I'm working with it to update ember-auth with the new APIs. For now, this enhancement is put on hold - the solution based on the new router is likely to be very different from one based on the previous router. I'll post an updated demo use case reflecting this after I finish with updating ember-auth.

Ref:

heartsentwined commented 11 years ago

@ryw your use case is now addressed with ember rc6 and ember-auth 7.x releases. The logic behind it is different though, in that

In other words,

the new router now encourages you to use authRedirectable as "the ember way" of solving auth-only routes (with auth-only models)


7.x branch now released, with rc6 (new router!) support. changelog, upgrade guide, docs and demo all properly updated. Main notes: