Created
April 28, 2019 22:30
-
-
Save mraaroncruz/3f769370077b513fdc0f006f04a16cbd to your computer and use it in GitHub Desktop.
JWT params middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Middlewares | |
class JwtParams | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
token = request.params['auth'] | |
env['HTTP_AUTHORIZATION'] = "Bearer #{token}" if token | |
@app.call(env) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment