Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6623831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:34:46+00:00 2026-05-25T21:34:46+00:00

I am working on a rails web application that also provides JSON based API

  • 0

I am working on a rails web application that also provides JSON based API for mobile devices . mobile clients are expected to first obtain a token with (email/pass), then clients will make subsequential API calls with the token.

I am pretty new to Devise, and I am looking for a Devise API look like authenticate(email, pass) and expect it to return true/false, then based on that I will either create and hand back the token or return a decline message. but seems Devise doesn’t provide something like this.

I am aware that Devise 1.3 provides JSON based auth, but that’s a bit different from what I need – I need to generate token and handle back to client, then after that auth is done using the token instead.

Can someone please give some pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:34:46+00:00Added an answer on May 25, 2026 at 9:34 pm

    There is a devise configuration called :token_authenticatable. So if you add that to the devise method in your “user”, then you can authenticate in your API just by calling

    "/api/v1/recipes?qs=sweet&auth_token=[@user.auth_token]"
    

    You’ll probably want this in your user as well:

    before_save :ensure_authentication_token
    

    UPDATE (with API authorization code)

    The method you’re looking for are:

    resource = User.find_for_database_authentication(:login=>params[:user_login][:login])
    resource.valid_password?(params[:user_login][:password])
    

    here’s my gist with a full scale JSON/API login with devise

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Rails web application, and it's currently being used by some
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I am working on a Rails application that needs to handle dates and times
I'm working on a Rails web application with a MySQL database. I'm using migrations
i'm working in a big and rich rails web application using tons of javascript.
We're working on some Ruby on Rails web application which is currently in English
I'm working on a web application right now using Rails and wanted to see
I've been working on a web application for a company that assists them with
I'm working on a Ruby on Rails application that used the Devise authentication system.
I am working on a web application that will deal with many image uploads.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.