mainmatter / ember-simple-auth

A library for implementing authentication/authorization in Ember.js applications.
https://ember-simple-auth.com
MIT License
1.92k stars 603 forks source link

Deprecation warning in latest ember, since access to instances in initializers is deprecated #517

Closed koemeet closed 9 years ago

koemeet commented 9 years ago

Hi,

In the latest ember version, you cannot access instances of a container in the intializer anymore, see: http://emberjs.com/deprecations/v1.x/#toc_deprecate-access-to-instances-in-initializers. Currently, this library triggers a lot of deprecation errors in latest ember version.

Any plans on updating simple-auth to support later ember versions?

Keeo commented 9 years ago

@NullVoxPopuli secure.token is for 0.8.0, session.authenticated.token is for 1.0.0 or jj-abrams branch. You can override session, no need for initializer and reopen.

NullVoxPopuli commented 9 years ago

looks like this repo doesn't have a tag for 1.0.0. :-\

I tried changing the package.json from 0.8.0 to 1.0.0 as well as bower.json.

:-\

Keeo commented 9 years ago

@NullVoxPopuli sorry, 1.0.0 is coming soon,.. You should stick with 0.8.0 till there is finished documentation for it.

Anyway you can override session and do it like this (for 0.8.0): https://gist.github.com/Keeo/8c688f5e131b32cdb6c0 You can ask me there, if something is not clear. I didn't test this code, but it's looking good to me.

kjhangiani commented 9 years ago

1.0.0 has some enormous breaking changes, there's no way I can trivially upgrade ESA, however, at the same time, I'd like to handle these deprecations so I can push forward ember to 1.13 and 2.0. Is there a release of 0.8.0 branch that takes care of these container/lookup deprecations?

I'm currently using 0.8.0

marcoow commented 9 years ago

I wrote an upgrade guide here: http://log.simplabs.com/post/131698328145/updating-to-ember-simple-auth-10. A version of 0.8.0 that works with Ember.js 2.0 would be quite complex and was considered not worth the effort. Upgrading to 1.0 is not as hard as it might first appear.

kjhangiani commented 9 years ago

Thanks for the link, that will help considerably.

I might give that a go tomorrow.. too late now for me to break everything :)

Quick question - Is the session in 1.0.0 available in the registry as service:session, since it's just an ember service now? For injection purposes, in an instance initializer

marcoow commented 9 years ago

sure - service:session

Am 27.10.2015 um 08:30 schrieb Kevin Jhangiani notifications@github.com:

Thanks for the link, that will help considerably.

I might give that a go tomorrow.. too late now for me to break everything :)

Quick question - Is the session in 1.0.0 available in the registry as service:session, since it's just an ember service now? For injection purposes, in an instance initializer

— Reply to this email directly or view it on GitHub.

BransonGitomeh commented 9 years ago

a clean install of this addon now breaks ember with a `container.lookup is not a function err``

node: 0.12.7 npm: 2.13.4 os: linux x64 embercli - 1.13.8 "ember": "^2.0.0",

MattNguyen commented 8 years ago

In the previous currentUser examples, why is DS.PromiseObject used to wrap store#find? Seems unnecessary when store#find returns a promise.

cc @Awem

dschmidt commented 8 years ago

you can access currentUser.name in a template with DS.PromiseObject