デバイスのauthenticate_userを使用します!コントローラのメソッド。これは、リクエストで提供されたauth_tokenが正しい場合は正常に機能しますが、認証が失敗した場合は、次のようになります。
curl -XGET 'http://localhost:3000/my_obj?auth_token=wrongtoken'
<html><body>You are being <a href="http://localhost:3000/users/sign_in">redirected</a>.</body></html>
私はrablを使用しているので、次のようなものを作成するための最良の方法は何ですか
{'error' : 'authentication error'}
htmlリダイレクトの代わりに返されましたか?