{"action":"opened","issue":{"url":"https://api.github.com/repos/SkyLothar/lua-resty-jwt/issues/7","labels_url":"https://api.github.com/repos/SkyLothar/lua-resty-jwt/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/SkyLothar/lua-resty-jwt/issues/7/comments","events_url":"https://api.github.com/repos/SkyLothar/lua-resty-jwt/issues/7/events","html_url":"https://github.com/SkyLothar/lua-resty-jwt/issues/7","id":110973932,"number":7,"title":"no start line - RS256","user":{"login":"freman","id":506680,"avatar_url":"https://avatars.githubusercontent.com/u/506680?v=3","gravatar_id":"","url":"https://api.github.com/users/freman","html_url":"https://github.com/freman","followers_url":"https://api.github.com/users/freman/followers","following_url":"https://api.github.com/users/freman/following{/other_user}","gists_url":"https://api.github.com/users/freman/gists{/gist_id}","starred_url":"https://api.github.com/users/freman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freman/subscriptions","organizations_url":"https://api.github.com/users/freman/orgs","repos_url":"https://api.github.com/users/freman/repos","events_url":"https://api.github.com/users/freman/events{/privacy}","received_events_url":"https://api.github.com/users/freman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-12T13:22:10Z","updated_at":"2015-10-12T13:22:10Z","closed_at":null,"body":"Greetings.\r\n\r\nI'm not sure if it's something I'm completely borking up, but I can't see another way to do it.\r\n\r\nWe use your library to send JWT's from our frontends to our backends out of paranoia - this is working great, php has no trouble decoding these.\r\n\r\nI am now trying to use your library to accept a JWT from a different provider (encoded with go-jwt)\r\n\r\nThis is the public key\r\n```\r\n-----BEGIN PUBLIC KEY-----\r\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0UJybPz2/GQAGh/Ri3rvsv60h\r\nfYB3JzoZpWzKBPPXeHC/w7rnOSdOjeqLT4evgfRXjsld9Rx5GYXARiEicTl1l9DU\r\n+P9xk0eptU/Cawz003/XT5tPX+uhmFcC3zIa3oUb/25Kq+IPeq1AUTK9PcJsohFk\r\npcgtuZvphRLKvFA8uQIDAQAB\r\n-----END PUBLIC KEY-----\r\n```\r\n\r\nThis is the token\r\n```\r\neyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0NDQ2OTQxNzksImlhdCI6MTQ0NDY1MDk3OSwiaXAiOiIxNzIuMTYuMjAzLjEiLCJuYmYiOjE0NDQ2NTA5NzksInVzZXIiOiJzaGFubm9uLnd5bnRlciJ9.PLEe64xKFGpkwrX2OameIT6_xSpl5mW_BxFmI4sz20SS_jOaemWrwUBB4gMIUm9LwhxUWTAr5wdLMF30bDJLSfQamf2VeggGMzvjKMQdbJcOPzT6QPmuITAju7bn6WzLzEE5cThIXhOCEdNGKf1xDp9om9T8HVZ15nWpuwwvqwo\r\n```\r\n\r\nThis is the output\r\n```\r\n{\"payload\":{\"nbf\":1444650979,\"ip\":\"172.16.203.1\",\"exp\":1444694179,\"user\":\"shannon.wynter\",\"iat\":1444650979},\"reason\":\"no start line\",\"raw_header\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9\",\"valid\":true,\"header\":{\"alg\":\"RS256\",\"typ\":\"JWT\"},\"signature\":\"PLEe64xKFGpkwrX2OameIT6_xSpl5mW_BxFmI4sz20SS_jOaemWrwUBB4gMIUm9LwhxUWTAr5wdLMF30bDJLSfQamf2VeggGMzvjKMQdbJcOPzT6QPmuITAju7bn6WzLzEE5cThIXhOCEdNGKf1xDp9om9T8HVZ15nWpuwwvqwo\",\"verified\":false,\"raw_payload\":\"eyJleHAiOjE0NDQ2OTQxNzksImlhdCI6MTQ0NDY1MDk3OSwiaXAiOiIxNzIuMTYuMjAzLjEiLCJuYmYiOjE0NDQ2NTA5NzksInVzZXIiOiJzaGFubm9uLnd5bnRlciJ9\"}```\r\n```\r\n\r\nAnd this is how I get that\r\n\r\n```\r\nlocal cookie_value = ngx.var.cookie_lda\r\nif (cookie_value == nil) then\r\n    ngx.exit(401)\r\nelse\r\n    local public_key = [[-----BEGIN PUBLIC KEY-----\r\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0UJybPz2/GQAGh/Ri3rvsv60h\r\nfYB3JzoZpWzKBPPXeHC/w7rnOSdOjeqLT4evgfRXjsld9Rx5GYXARiEicTl1l9DU\r\n+P9xk0eptU/Cawz003/XT5tPX+uhmFcC3zIa3oUb/25Kq+IPeq1AUTK9PcJsohFk\r\npcgtuZvphRLKvFA8uQIDAQAB\r\n-----END PUBLIC KEY-----]]\r\n\r\n    local jwt_obj = jwt:verify(public_key, cookie_value)\r\n    ngx.log(ngx.ERR, cjson.encode(jwt_obj))\r\nend\r\n```\r\n\r\nThe debug tool at jwt.io says it's a verified signature but this library won't verify it saying \"no start line\"\r\n\r\nAny help?"}}