I have an app which uses Rails API backend and React frontend. It works locally but after I deployed it to Heroku all the requests that require authentication fail and give
Error: "Token is invalid"
I have checked the headers and the token is there. Can't figure out by looking at Heroku logs what the problem is.
Did someone have a similar issue? Thanks!
A snippet from Heroku logs:
2017-10-26T17:56:36.419481+00:00 app[web.1]: I, [2017-10-
26T17:56:36.419403 #4] INFO -- : [bc68efaf-22e2-4274-92d8-
d1202d2b1228] Parameters: {"auth"=>{}}
2017-10-26T17:56:36.420592+00:00 app[web.1]: I, [2017-10-
26T17:56:36.420511 #4] INFO -- : [bc68efaf-22e2-4274-92d8-
d1202d2b1228] [active_model_serializers] Rendered
ActiveModel::Serializer::Null with Hash (0.18ms)
2017-10-26T17:56:36.421050+00:00 app[web.1]: I, [2017-10-
26T17:56:36.420931 #4] INFO -- : [bc68efaf-22e2-4274-92d8-
d1202d2b1228] Filter chain halted as :authenticate_token! rendered or
redirected
2017-10-26T17:56:36.421378+00:00 app[web.1]: I, [2017-10-
26T17:56:36.421175 #4] INFO -- : [bc68efaf-22e2-4274-92d8-
d1202d2b1228] Completed 403 Forbidden in 2ms (Views: 1.1ms |
ActiveRecord: 0.0ms)
Heroku has settings where you can define variables. It's possible you have a .env variable or something similar that needs to be defined there, because Heroku isn't recognizing it.