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 trialEnrique Gonzalez
3,490 PointsHow would api authentication work using the Devise gem?
Providing a gist, repo, or additional download would be great!
1 Answer
Alan Matthews
10,161 PointsIt would depend how the API is setup. You can make an HTTP GET request to an API that requires no authentication. DELETE, POST, PATCH, UPDATE, EDIT requests almost always need some user authentication. Regular Devise would need an auth token passed either in the message body or header to the API to perform certain HTTP requests. After login with Devise, the auth token is returned to the user to use in any authentication based HTTP requests. You would then setup a before_action callback to verify the token against the user.