ember-simple-auth-torii Facebook provider never returns promise from open function -
i'm using ember-simple-auth-torii
custom facebook oauth2 authenticator, never seem able have promise return data (for data.authorizationcode
). popup window hangs until close it, @ point popupclosed error message.
what missing should doing?
thanks!
facebookauthenticator = oauth2.extend torii: null provider: "facebook-oauth2" authenticate: (credentials) -> = new ember.rsvp.promise((resolve, reject) -> that.torii.open(that.provider).then((data) -> data = facebook_auth_code: data.authorizationcode that.makerequest(that.servertokenendpoint, data).then ((response) -> ember.run -> expiresat = that.absolutizeexpirationtime(response.expires_in) that.scheduleaccesstokenrefresh response.expires_in, expiresat, response.refresh_token resolve ember.$.extend(response, expires_at: expiresat, access_token: response.access_token, user_id: response.user_id ) ), (xhr) -> ember.run -> reject xhr.responsejson or xhr.responsetext ) ) facebookauthentication = name: "facebook-authentication" before: "simple-auth" after: 'torii' initialize: (container) -> session.reopen user: (-> userid = @get('user_id') if (!ember.isempty(userid)) return container.lookup('store:main').find('user', userid) ).property('userid') torii = container.lookup('torii:main') authenticator = facebookauthenticator.create torii: torii container.register("authenticator:facebook", authenticator, { instantiate: false }) `export default facebookauthentication`
the problem having incorrect url.
you need set url in facebook's advanced app settings, , ensure same url ember-cli app specified in redirecturi
.
Comments
Post a Comment