D
D
Dmitry Rotaty2015-05-25 20:16:41
Ruby on Rails
Dmitry Rotaty, 2015-05-25 20:16:41

Where can I get a token from for requests to a server with a rails application if the devise authorization gem is used?

Hello. I am writing a rails application using the 'devise' gem for authorization. There was a task - it is necessary to create a certain entity in the database using a script. With the help of requests, nothing happens, because even without the authorization gem, a token was generated, without which the request did not pass, and now everything has become even more complicated.

Parameters: {"utf8"=>"✓", "authenticity_token"=>"rszhzpmYuHQ/stzGrASr1MXZMOGe8/QahdTTjgOhIzYCZ8oKKwTMdJTJUphrjNUPej9gczouWt987M0iclY4Lw==", "product"=>{"name"=>"name", "status"=>"status", "version"=>"version"}, "commit"=>"Create Product"}

One solution would be to create a separate controller, with a single action that would wait for a request on a certain route with a login, password, information about what and with what data to create, but it seems to me that this is not the best idea with safety point of view. Maybe there are some civilized solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-05-25
@Flamine

Devise has nothing to do with it. This is all the line:
This task is called API. For this, just what is needed
The API can be public or private. Do you want everyone to be able to do this action? Then make it action and leave it as it is.
Is it necessary that the opportunity be limited?
Use one or another way to generate an API key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question