ember-simple-auth

How to store the user in a session

橙三吉。 提交于 2019-12-30 06:45:03
问题 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

Ember SimpleAuth isAuthorised on itemController

ⅰ亾dé卋堺 提交于 2019-12-25 04:22:40
问题 In my app I need users to be given access to organisations according to a many-to-many relationship like this: App.User = DS.Model.extend({ fullname: DS.attr('string'), password: DS.attr('string'), administrator: DS.attr('boolean'), organisation_users: DS.hasMany('organisation_user', {async: true}) }); App.OrganisationUser = DS.Model.extend({ organisation: DS.belongsTo('organisation', {async: true}), user: DS.belongsTo('user', {async: true}), administrator: DS.attr('boolean') }); App

Capturing failed request with ember-simple-auth

元气小坏坏 提交于 2019-12-24 01:01:46
问题 I am adding functionality to allow users to reject un-expired oauth tokens. (I am using ember-simple-auth-oauth2 and a custom oauth2 implimentation). I would like to notify clients using a rejected token that their token was manually rejected. The 401 response from the server contains the reason the token is no longer valid ({message: "Token was expired by ip 1.1.1.1"}). None of the invalidationSucceeded callbacks or events in the session or application mixin seem to have the 401 request

CORS preflight channel did not succeed

▼魔方 西西 提交于 2019-12-23 08:05:21
问题 I'm trying to build a Ember app with PHP REST framework as my api locally. The Ember app is being served at http://localhost:4200 and the api is being served from just http://localhost . This is causing a CORS issue. I've tried everything that I can think of, but I keep getting an error back saying the request was blocked and that the preflight channel did not succeed. It doesn't succeed in Firefox or Chrome. I've added the following to the .htaccess file for my api: Header set Access-Control

Ember Simple Auth: Session lost on refresh

可紊 提交于 2019-12-18 15:31: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: 回答1: 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

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

不打扰是莪最后的温柔 提交于 2019-12-17 22:14:36
问题 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.

Ember Simple Auth (with token plugin) won't add the Authorization header with the token

牧云@^-^@ 提交于 2019-12-13 18:18:10
问题 I had a simple and working application with Ember CLI 0.1.12. I use the Ember Simple Auth addon with the Token authenticator and authorizer. https://github.com/jpadilla/ember-cli-simple-auth-token First, I wasn't able to authenticate, because I had no idea what the server was supposed to return. After a lot of googling, I was able to figure out that the server should return something like this: { "access_token": "ToKeN123hEre" } Now I was able to authenticate and sessions work. But when I

Custom authenticator with Ember simple auth + Ember CLI

荒凉一梦 提交于 2019-12-13 14:23:28
问题 I'm trying to write a custom authenticator, similar to the one from this example in the docs. The goal is to be able to retrieve the currently logged in user via session.user . I'm using Ember CLI, so in initializers/authentication.js I have import Ember from 'ember'; var customAuthenticator = Ember.SimpleAuth.Authenticators.Devise.extend({ authenticate: function(credentials) { debugger; } }); export default { name: 'authentication', initialize: function(container, application) { Ember

Ember-simple-auth custom authorizer not called

孤街醉人 提交于 2019-12-12 02:22:36
问题 I'm trying to implement custom auth with ember-simple-auth and I stuck at the start. I have app/autheticators/digest.js import Base from 'ember-simple-auth/authenticators/base'; import Ember from 'ember'; export default Base.extend({ restore(data) { // }, authenticate(email, password) { console.log(email, password); return new Ember.RSVP.Promise(function(resolve, reject) { Ember.run(function() { resolve({email: email, password: password}); }); }); }, invalidate(data) { // } }); app

currentUser fetched in Authentication with Torii?

﹥>﹥吖頭↗ 提交于 2019-12-12 00:25:34
问题 Trying to change a torii authenticator to return an account id from the response, so it's available in the session for fetching the account. In trying to adapt the example to the torii authenticator, I have this starting point (obviously wrong, hitting on my js knowledge limits): import Ember from 'ember'; import Torii from 'simple-auth-torii/authenticators/torii'; import Configuration from 'simple-auth-oauth2/configuration'; export default Torii.extend({ authenticate: function(credentials) {