givanse / ember-cli-simple-auth-devise

:key: Authenticate to a Rails/Devise server from Ember CLI.
The Unlicense
40 stars 9 forks source link

Registration #3

Open bahudso opened 10 years ago

bahudso commented 10 years ago

An enhancement would be to have registration rather than simply login.

givanse commented 10 years ago

You can achieve that from an Ember route/template by sending a POST request to the route provided by Devise /users/sign_up. You just have to write your own form/template and have it send the values that Devise expects.

A feature like this is out of scope for this project. The objective here is to get you started with the authentication process only.

bahudso commented 10 years ago

I am having issues with the CSRF token authenticity.

Started GET "/api/csrf" for 127.0.0.1 at 2014-07-01 17:44:31 -0400
Processing by Api::CsrfController#index as */*
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)

Started POST "/users" for 127.0.0.1 at 2014-07-01 17:44:38 -0400
Processing by Devise::RegistrationsController#create as HTML
Can't verify CSRF token authenticity
Completed 422 Unprocessable Entity in 3ms

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): 

https://github.com/bahudso/ember-rails-blog

givanse commented 10 years ago

Check that rails-csrf is installed and working properly.

bahudso commented 10 years ago

After reinstalling & updating to rails-csrf 0.0.4 it is working. But after restarting both the rails and ember servers it now fails again...

Now after reverting back to 0.0.3 it works fine. But the user is not added to the rails backend, and after registration any login succeeds...

I attempted to add it to a fork of this repo here: https://github.com/bahudso/ember-cli-simple-auth-devise

givanse commented 10 years ago

If any input logins successfully its because the server is sending session cookies, disable them. There is a note about that in the README.

I'll probably need this too, not sure how soon, but I'll update this thread when its done.

givanse commented 10 years ago

https://github.com/simplabs/ember-simple-auth/issues/201

givanse commented 10 years ago

For future reference: https://github.com/simplabs/ember-simple-auth/issues/73

Leooo commented 9 years ago

Just adding a serverTokenRegisterEndpoint, and an option in simple-auth/session/authenticate, simple-auth-devise/authenticators/devise/authenticate, simple-auth-device/authenticators/devise/makeRequest to toggle the EndPoint between sign in ( serverTokenRegisterEndpoint) and sign up (serverTokenEndpoint) ?

=> Sign in up from an ajax request then using ember-simple-auth's authenticate method needs two server requests when it is not really needed: we can send the credentials straight from the signup request