Ember-Simple-Auth currentUser example help required

前端 未结 1 1757
野趣味
野趣味 2021-01-25 02:21

So I realize that the account example here: https://github.com/simplabs/ember-simple-auth/blob/8863c032fcea6148a5b3365be5d66dc2389d301d/examples/4-authenticated-account.html

相关标签:
1条回答
  • 2021-01-25 02:42

    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.

    0 讨论(0)
提交回复
热议问题