moonming commented on a change in pull request #1027: Jwt authentication plugin compatible with Bearer prefix URL: https://github.com/apache/incubator-apisix/pull/1027#discussion_r363205726
########## File path: lua/apisix/plugins/jwt-auth.lua ########## @@ -90,16 +91,19 @@ end local function fetch_jwt_token() - local args = ngx.req.get_uri_args() - if args and args.jwt then - return args.jwt - end - local headers = ngx.req.get_headers() if headers.Authorization then + if sub_str(headers.Authorization,1,7) == 'Bearer ' then + return sub_str(headers.Authorization,8) + end return headers.Authorization end + local args = ngx.req.get_uri_args() + if args and args.jwt then Review comment: please use `ngx.ctx.api_ctx.jwt` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services