tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

Not seeing user registration? #22

Open sfielder opened 9 years ago

sfielder commented 9 years ago

Is there a reason for no user reg?

Thanks and looking for a recommendation on how best to handle new signups

tarlepp commented 9 years ago

I'm planning to do user CRUD after login, which is also requested #20 . Also I'm doing major refactor job atm to whole boilerplate so I have to finish those first.

Sorry, that I cannot give you any timeframe for this, but it's coming at somepoint. Feel free to make a PR about this or/and continue this thread with wishes and actual functionality spec about this feature.

stevenirby commented 9 years ago

I'm curious how this is going to be done with the client and server being on two different domains. So far, I haven't been successful, getting Facebook and Google login/registration working.

They're don't allow you to make an ajax request to the backend, then have the response redirect you to facebook/google. (which is a good thing)

I've had to resort to using a login page severed up from sails, bypassing the frontend. Still, you have to set the auth_token on the frontend domain's localstorage. I guess I could use a cross-domain hack to do this.

I'm starting to think running the backend and frontend on two different domains is a horrible idea. Deploying this is also tricky, especially if pushing to heroku or something similar. That's for another discussion though.

tarlepp commented 9 years ago

@stevenirby basically like this http://matthewtyler.io/handling-oauth2-with-node-js-and-angular-js-passport-to-the-rescue/

stevenirby commented 9 years ago

@tarlepp thank you! I finally got it working. I needed to do this:

response.writeHead(302, {
    'Location' : 'http://localhost:3001/dashboard?token=' + data.token + '&user=' + user.email
});
response.end();

Instead I was trying to return json to the client or just do a response.redirect('http://localhost:3001/dashboard', 200);

ProLoser commented 9 years ago

That link is dead. How do I do local and oauth registration?

tarlepp commented 9 years ago

This one is "hard", I'm thinking to make something for this in my "christmas" holiday - maybe.

tarlepp commented 9 years ago

So basically no progress on my "christmas" holiday for this... Now I got some time for this project again, not much but some, so I'll try to implement this. And if you guys have already done this, please share that.

ghost commented 9 years ago

+1

tarlepp commented 9 years ago

This is something that I should take proper look, unfortunately I don't really time to do all this... So if one you have done this already please make a PR.

Tenkir commented 9 years ago

I'm having trouble where the user information is sent to the oauth popup window rather than the web app. Sometimes it will show the JWT token, other times it shows an "Invalid User Error"

tarlepp commented 9 years ago

@Tenkir popup?

Tenkir commented 9 years ago

@tarlepp: Facebook's login page popup window.

tarlepp commented 9 years ago

@Tenkir oh ok, that explains. Note that only local auth is supported atm.

Tenkir commented 9 years ago

I've almost got this worked out, I'm just having an issue getting the data from the oauth popup back to the angular app. I'm getting:

DOMException: Blocked a frame with origin "http://localhost:9000" from accessing a cross-origin frame.

Anyone have any idea how to get this working? Once it does I'll open a PR.

Here's a gist: https://gist.github.com/Tenkir/ffe243b85ebb98e0910f

EDIT: I got this working, though it's not elegant. Basically I pull the JSON text from the HTML body and parse it into the parent window.