ember-simple-auth

How to use a custom authorizer and custom authenticator for ember simple-auth in ember cli

情到浓时终转凉″ 提交于 2019-12-03 08:08:48
I don't understand how I'm supposed to include my custom authenticator and custom authorizor with ember cli. Where to put it and what to include and how to do it. The cli example for simple-auth provided unfortunately does not cover custom authorizer and authenticator. The build is successfully, but when running it in the browser, I get the error TypeError: SimpleAuth.Authenticators is undefined I'm aware that I'm doing something wrong, but could you please guide me or point me to the right documentation on how to do this, I can't find anything :( My initializer looks like this: import Ember

Ember-Simple-Auth currentUser example help required

旧街凉风 提交于 2019-12-02 07:54:07
问题 So I realize that the account example here: https://github.com/simplabs/ember-simple-auth/blob/8863c032fcea6148a5b3365be5d66dc2389d301d/examples/4-authenticated-account.html Provides the code for retrieving the currently logged in account. I just have a few questions about the example as I am trying to get it working in an Ember-CLI app. SimpleAuth is being used in the example however, I don't know where it's coming from as I am trying to import SimpleAuth from ... but I don't know what file

Ember-Simple-Auth currentUser example help required

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:09:57
So I realize that the account example here: https://github.com/simplabs/ember-simple-auth/blob/8863c032fcea6148a5b3365be5d66dc2389d301d/examples/4-authenticated-account.html Provides the code for retrieving the currently logged in account. I just have a few questions about the example as I am trying to get it working in an Ember-CLI app. SimpleAuth is being used in the example however, I don't know where it's coming from as I am trying to import SimpleAuth from ... but I don't know what file to import it from. Furthermore, I am wondering if the response from the server now needs to return the

Simple auth addon seems to not be reading env config

天涯浪子 提交于 2019-12-02 02:42:00
问题 I am following the example here, and I have this in my config/environment.js file: ENV['simple-auth'] = { authorizer: 'simple-auth-authorizer:devise', routeAfterAuthentication: 'landing-pages' }; However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library. I tried import ing the configuration in the

Simple auth addon seems to not be reading env config

。_饼干妹妹 提交于 2019-12-02 01:33:47
I am following the example here , and I have this in my config/environment.js file: ENV['simple-auth'] = { authorizer: 'simple-auth-authorizer:devise', routeAfterAuthentication: 'landing-pages' }; However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library. I tried import ing the configuration in the environment.js file ES6-style, but that doesn't seem possible. Ember Simple Auth actually still relies on the

Ember Simple Auth custom authenticator

左心房为你撑大大i 提交于 2019-12-01 08:30:22
I've been trying to create a session.currentUser property with an id , email , and points properties. I'm referencing Custom authenticator with Ember simple auth + Ember CLI and How to store the user in a session , but I just can't figure out how the pieces fit together. I'm using Ember CLI. In my index.html , I have: window.ENV['simple-auth'] = { authorizer: 'simple-auth-authorizer:devise', session: 'session:custom' }; In initializers/custom-session.js , I have: import Session from 'simple-auth/session'; import Devise from 'simple-auth-devise/authenticators/devise'; export default { name:

How to store the user in a session

旧时模样 提交于 2019-11-30 21:46:22
I am trying to set up ember-simple-auth with a django-rest-framework backend, but I'm running into some trouble saving the user to the session. I have to be able to do something like this in my templates: <h2>Welcome back, {{session.user}}</h2> So following several guides I found, I have got the authentication and authorization working so that I can get a valid token and use is in requests. To get the user on the session, I have modified App.CustomAuthenticator.authenticate so that when the token is returned, the username is also stored to the session: authenticate: function(credentials) { var

Ember Simple Auth: Session lost on refresh

不羁的心 提交于 2019-11-30 12:42:03
I'm using Ember Simple Auth Devise v 0.6.4 in an Ember-cli app. I can log in fine but when I refresh the page the session is lost. (Tested in Firefox and Chrome.) Right after logging in, inspecting the localStorage shows the session and after refreshing localStorage is empty. Here's what's in the local storage when I sign in: The problem is that you have neither user_token nor user_email in the session which are required for the session to be authenticated. So as soon as you reload the page the authenticator's restore method rejects the session. Also without user_token and user_email the

Workflow for Ember-simple-auth, Torii and Facebook Oauth2

不羁的心 提交于 2019-11-28 17:37:21
After my previous question about ember-simple-auth and torii , I successfully authenticate my users with their Facebook accounts. But currently, torii's provider facebook-oauth2 is returning an authorization code from Facebook ; when the promise resolves, I send this authorization code to my backend where I perform a request against Facebook to get the user's id and email : then I authenticate the user on my backend, generating a specific access token and sending back to my ember application. Client code : // app/controllers/login.js import Ember from 'ember'; import LoginControllerMixin from

Ember Simple Auth - injecting current user into every route

自作多情 提交于 2019-11-28 06:37:35
I am building a site using Ember Simple Auth. I followed these instructions to try and add the current user object to the session and it worked, using this slightly adapted code: import Ember from 'ember'; import Session from 'simple-auth/session'; export default { name: "current-user", before: "simple-auth", initialize: function(container) { Session.reopen({ setCurrentUser: function() { var accessToken = this.get('secure.token'); var _this = this; if (!Ember.isEmpty(accessToken)) { return container.lookup('store:main').find('user', 'me').then(function(user) { _this.set('content.currentUser',