Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Created April 28, 2019 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/3f769370077b513fdc0f006f04a16cbd to your computer and use it in GitHub Desktop.
Save mraaroncruz/3f769370077b513fdc0f006f04a16cbd to your computer and use it in GitHub Desktop.
JWT params middleware
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