Closed AlexLv closed 9 years ago
@AlexLv My recommendation would be to checkout the EmberCLI addon I created ember-token-auth which demonstrates how to use EmberOAuth2 for EmberCli projects.
In generally it isn't the greatest idea to use App.oauth. Instead a better approach is to use a Session model which is initialized at app startup and which has a reference to the Ember.OAuth2 object. When a user attempts to login by clicking a button it fires the action authenticate
on the login route which then uses the ember-oauth2
config to setup and then attempts to connect to the OAuth2 provider using EmberOAuth2.
You can use ember-token-auth in your project or look through the code and use it to help write your own authentication workflow.
I'll probably add something in the README or wiki about using a Session model.
I hope that helps.
@amkirwan Thanks for your reply. I will try again according to your suggestion.
Hello @amkirwan ,
I have a question in using your ember-oauth2(I've installed ember-cli in my project):
Where should I declare:App.oauth = Ember.OAuth2.create({providerId: 'google'}); and how to token App.oauth in redirect.html.
because when I click 'Accept' button it seems it didn't send request to google and the dialog didn't disappear.
I've no idea about this, I hope you can answer my question. Thanks.