Ember-Simple-Auth currentUser example help required

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:09:57

The SimpleAuth global is only defined in the browserified distribution of the library. When you're using ember-cli you import the individual components instead of accessing them via the global (see e.g. this example: http://log.simplabs.com/post/90339547725/using-ember-simple-auth-with-ember-cli).

To e.g. get the session you'd do sty like:

import Session from 'simple-auth/session';

Session.reopen({
  …
});

The example linked above requires the server to include the user_id in the response which is not compliant with the OAuth 2.0 specification but a customization. If you want/need to be compliant you could get the current user e.g. via a GET /me or sth. like that once the session is authenticated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!