0
votes

I already have a running Rails App with Devise. The authentication works perfectly, but now I want to build an API to make this App more open for other Applications.

I have a standard devise installation with a User Model.

The module devise-token_authenticatable is removed from the official devise gem right?

I want an versioned API like http://example.com/api/v1/

This route provides an API where you can get information via JSON.

I haven't found a solution yet to login a user via an API. At first the user sends the email and the password, now the App generates a token and returns it to the user if the combination is valid. Now you need to send this authentication token to the server at every request. If you want to sign out you destroy the authentication key.

Is there any gem out there who provides this implementation or are there any other approaches?

I already found this solution but I didn't get this working. https://github.com/lynndylanhurley/devise_token_auth

1

1 Answers

0
votes

Checkout Doorkeeper. https://github.com/doorkeeper-gem/doorkeeper. It is very effective.

It supports various Oauth flows, among which this will meet your requirement: https://github.com/doorkeeper-gem/doorkeeper/wiki/using-resource-owner-password-credentials-flow