Giter Site home page Giter Site logo

mainmatter / ember-cli-simple-auth-devise Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 7.0 1.29 MB

Ember CLI Addon for the Ember Simple Auth Devise package

Home Page: https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-devise

License: MIT License

JavaScript 100.00%

ember-cli-simple-auth-devise's People

Contributors

genkilabs avatar kimroen avatar marcoow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-cli-simple-auth-devise's Issues

Ember 2.0 Support? Can't Find module

I'm trying to get this to work with the jj-abrams branch of ember-cli-simple-auth. I'm unable to get the site to load, it get the error:

Uncaught Error: Could not find module simple-auth/utils/load-config imported from simple-auth-devise/configuration

I'm guessing it's a problem between ember-cli-simple-auth-devise version 0.8.0 and the jj-abrams branch of ember-cli-simple-auth.

Cannot import `LoginControllerMixin` nor `AuthenticatedRouteMixin`

I have this files:

// app/controllers/login.js
import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';

export default Ember.Controller.extend(LoginControllerMixin, {
  authenticator: 'simple-auth-authenticator:devise'
});

and

import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
});

But all I get is

file changed controllers/login.js
ENOENT, no such file or directory '/Users/arbeo/programming/cc/codecantor/forge/front/tmp/tree_merger-tmp_dest_dir-oHWBNxTx.tmp/simple-auth/mixins/authenticated-route-mixin.js'
Error: ENOENT, no such file or directory '/Users/arbeo/programming/cc/codecantor/forge/front/tmp/tree_merger-tmp_dest_dir-oHWBNxTx.tmp/simple-auth/mixins/authenticated-route-mixin.js'
  at Object.fs.statSync (fs.js:689:18)
  at addModule (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:83:46)
  at addModule (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:126:9)
  at /Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:59:7
  at tryCatch (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:163:16)
  at invokeCallback (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:172:17)
  at publish (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:150:13)
  at flush (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/asap.js:51:9)
  at process._tickCallback (node.js:419:13)

file changed controllers/login.js
ENOENT, no such file or directory '/Users/arbeo/programming/cc/codecantor/forge/front/tmp/tree_merger-tmp_dest_dir-JdsF9Yrs.tmp/simple-auth/mixins/login-controller-mixin.js'
Error: ENOENT, no such file or directory '/Users/arbeo/programming/cc/codecantor/forge/front/tmp/tree_merger-tmp_dest_dir-JdsF9Yrs.tmp/simple-auth/mixins/login-controller-mixin.js'
  at Object.fs.statSync (fs.js:689:18)
  at addModule (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:83:46)
  at addModule (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:126:9)
  at /Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:59:7
  at tryCatch (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:163:16)
  at invokeCallback (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:172:17)
  at publish (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/-internal.js:150:13)
  at flush (/Users/arbeo/programming/cc/codecantor/forge/front/node_modules/ember-cli/node_modules/rsvp/dist/commonjs/rsvp/asap.js:51:9)
  at process._tickCallback (node.js:419:13)

I'm fairly new to ember-cli, though I was following this article with simple-auth-devise instead of plain simple-auth.

No 'Access-Control-Allow-Origin' header is present on the requested resource

As I'm trying to use this from ember-cli, my Rails app is on a different host/port. So using serverTokenEndpoint I pointed simple-auth to the proper server but now hit:

ENV['simple-auth-devise'] = {
  serverTokenEndpoint: 'http://localhost:3100/users/sign_in',
};

Results in:

No 'Access-Control-Allow-Origin' header is present on the requested resource

Is this something that can be fixed with ENV.contentSecurityPolicy or something else?

The globPattern "undefined" did not match any files, so no file updates will be made.

Pretty stumped by this ... I'm guessing one of the packages I installed has changed an extension, but having trouble seeing which file the generator is trying to update ... any pointers?

ember generate ember-cli-simple-auth-devise
version: 0.1.4
The globPattern "undefined" did not match any files, so no file updates will be made.
Installing browser packages via Bower...
cached git://github.com/simplabs/ember-simple-auth-component.git#0.7.2
Installed browser packages via Bower.

ember-cli 0.2.0 compatibility

When installing the addon into a fresh ember-cli 0.2.0-beta.1 project the browser throws the following error:

Uncaught Error: Could not find module simple-auth/utils/load-config

Still looking into the exact cause.

Authenticate with something other than email

I love this plugin, but the first (and only) issue I found was that our existing Rails app requires the user to login with a 'username' rather than the default email. Devise provides several ways to do this out of the box: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-with-something-other-than-their-email-address
We went with the :authentication_keys => [:username] param in the User model.

Is there any way to set up a config to change the authenticator and authorizor to pass something other than user_email?

Session data persisted under "secure" with resourceName as "user"

Hello,

I'm trying to access the current user data from my session, and would like to persist additional data in the session for completing a registration workflow that I check against in routes outside of the workflow and redirect as needed. Researching this I stumbled on the following which seems to provide some insights:
http://stackoverflow.com/questions/30872684/ember-simple-auth-injecting-current-user-into-every-route

However it seems that the user key is not in local storage, rather it's under secure. So if I wanted to do something like get the session email, I'd have to do something like this:
{{ session.secure.email }} or {{ session.secure.activated }}

Looking at the local storage I see:
{"secure":{"authenticator":"simple-auth-authenticator:devise","email":"[email protected]","token":"Qw95117abc87fxxB66zo","activated":false}}

In my environment.js file I've added resourceName as user:

ENV['simple-auth'] = {
    authorizer: 'simple-auth-authorizer:devise',
    crossOriginWhitelist: [ENV.API_URL]
  };
  ENV['simple-auth-devise'] = {
    resourceName: 'user',
    identificationAttributeName: 'email',
    tokenAttributeName: 'token',
    serverTokenEndpoint: `${ENV.API_URL}/users/sign_in`
  };

'POST http://localhost:4200/users/sign_in 404 (Not Found)' with Rails 5 version of Devise

I was trying around Rails 5 and had to use a modified version of Devise to make it work because of the new routes structure of Rails. The issue is that now every time I try to login I get a 404 error.

POST http://localhost:4200/users/sign_in 404 (Not Found)

My setup is identical to this one. Just wanted to put this out here, I'll try and see if I can find a fix around this.

setting identificationAttributeName not respected

Hi!

ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:devise',
  identificationAttributeName: 'user_name'
}

When trying to override the identificationAttributeName in my environment.js file it won't be respect and it keeps defaulting to 'user_email', am I missing something here?

token key invalidating session and clearing localStorage

In this guide
https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-devise
you have the server return data with a token key.

 data = {
          token:      self.resource.authentication_token,
          user_email: self.resource.email
        }

I also see a commit "change devise user_token to token".
mainmatter/ember-simple-auth@e146cb5

When I use token as my key, the session doesn't persist during page reload because localStorage is cleared.

JSON.parse(localStorage['ember_simple_auth:session'])
Object {authenticator: "simple-auth-authenticator:devise", token: "bHbziDNfiM64hP_HqgPj", user_email: "[email protected]"}

I found this: http://stackoverflow.com/questions/25215010/ember-simple-auth-session-lost-on-refresh

When I change the data key to user_token in rails, the session persists. Not sure if I missed something.

405 Error In Production

I have my rails backend setup with Rack-Cors and configured for any origin. I also have the crossOriginWhitelist parameter of ENV['simple-auth-devise'] set to my Rails API in my environment.js.

Locally I am able to authenticate using the remote Rails API, but when in production I get a 405 (Not Allowed). The request doesn't even make it to the Rails backend.

I'm not sure If the issue is in my configuration or something else.

Install instructions do not work

$ ember install ember-cli-simple-auth
version: 0.2.3
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
Installed packages for tooling via npm.
installing
Installing browser packages via Bower...
cached git://github.com/simplabs/ember-simple-auth-component.git#0.8.0-beta.1
Installed browser packages via Bower.
installing
The ember generate command requires an entity name to be specified. For more details, use ember help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.