Loop Redirect Error in Rails application

Asked

Viewed 20 times

-1

I am working on an application in Rails and doing tests via Postman, the application usually works normally after having logged in some user, I can test the endpoints correctly. But when I stay with the user logged in for a certain time, about 5 minutes at times, I get this Loop Redirect error:

inserir a descrição da imagem aqui

And in the Rails terminal I get several unauthorized errors:

inserir a descrição da imagem aqui

I have no idea what the problem might be and I haven’t been able to find others like it to try to solve it. The application uses Rails 6.1.3.2 and Devise 4.8.0.

1 answer

-3

Devise is an authentication for use on browser pages, authenticated via cookie and having a persistent session on the server. For the API’s the ideal is that you. use another form of authentication that we call stateless (where the server does not save session on your side, it validates every time with each request) as basic_auth, inform a header with a API_KEY and handle manually.

On the Developer wiki he even talks that he can support something via API, but I don’t know much. Worth looking at.

However I leave a hint that you try to use a different authentication for your API using a JWT, or even a basic-auth, or a specific header with API_KEY. All are known authentication formats via API.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.