Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Question: OAuth2 Node.js app authentication from a Rails app.

I'd like to create an authentication layer on top of my node.js app. However I want this authentication to be an AJAX/OAuth call to a different rails application I've created earlier. How can I implement such a thing on both rails and node.js? Any ideas?

I use devise in my rails app, what type of code do I need to write on the respond_to json, and what kind of dependencies should I use for node.js?

Optionally users should be register through the node.js app aswell. How would that be possible?

Id appreciate if u guys could help : Jason Seifer Jim Hoskins

3 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hi Izel Nakri! This is pretty complicated. Try looking in to single sign on solutions that work across applications. I recommend OAuth as a starting point, devise has some good integration solutions there. Hope that help! We unfortunately don't have a course on it.

Is there any chance to view the codebase of the 'coderacer' project? I'm trying to implement a node.js custom oauth client authentication, my rails app is the provider(doorkeeper gem). I couldn't find good examples on github do you guys know any?

In Rails you have add :token_authenticatable inside you model User.rb. Here I've implemented an API with authentication with a token to validate the user. You may serve as an example: https://github.com/patojimenez/awesome_game_api

Thanks alot for the responses, I'll look into them let you guys know.