roadauth-rails api jwt cors 2024

cors.rb for rails api only roadauth authentication.

The most important is to not expose: [‘authorization’] to receive the JWT token.

gem install rack-cors

# cors.rb
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow…


This content originally appeared on DEV Community and was authored by RAHUL DHOLE

cors.rb for rails api only roadauth authentication.

The most important is to not expose: ['authorization'] to receive the JWT token.

gem install rack-cors
# cors.rb
Rails.application.config.middleware.insert_before 0, Rack::Cors do
  allow do
    # also update application.rb allowed_hosts
    origins ENV['ALLOWED_HOSTS']&.split(',') || ['localhost']

    resource "*",
      headers: :any,
      expose: ['authorization'],
      methods: [:get, :post, :put, :patch, :delete, :options, :head]
  end
end


This content originally appeared on DEV Community and was authored by RAHUL DHOLE


Print Share Comment Cite Upload Translate Updates
APA

RAHUL DHOLE | Sciencx (2024-08-14T23:45:59+00:00) roadauth-rails api jwt cors 2024. Retrieved from https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/

MLA
" » roadauth-rails api jwt cors 2024." RAHUL DHOLE | Sciencx - Wednesday August 14, 2024, https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/
HARVARD
RAHUL DHOLE | Sciencx Wednesday August 14, 2024 » roadauth-rails api jwt cors 2024., viewed ,<https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/>
VANCOUVER
RAHUL DHOLE | Sciencx - » roadauth-rails api jwt cors 2024. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/
CHICAGO
" » roadauth-rails api jwt cors 2024." RAHUL DHOLE | Sciencx - Accessed . https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/
IEEE
" » roadauth-rails api jwt cors 2024." RAHUL DHOLE | Sciencx [Online]. Available: https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/. [Accessed: ]
rf:citation
» roadauth-rails api jwt cors 2024 | RAHUL DHOLE | Sciencx | https://www.scien.cx/2024/08/14/roadauth-rails-api-jwt-cors-2024/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.