Skip to content

bug:enable openid-connect plugin without redirect_uri got 500 error #2426

Description

@liuxiran

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • Question or discussion
  • Bug
  • Requirements
  • Feature or performance improvement
  • Other

Bug

  • Which version of Apache APISIX Dashboard, OS, and Browser?
  1. create a route, enable openid-connect plugin, configs:
{
	"name": "api2",
	"route_group_id": "de45ec14-317f-4177-8a22-10ab95bd45f7",
	"route_group_name": "group1",
	"status": true,
	"desc": "",
	"protocols": ["http"],
	"paths": ["/get1"],
	"methods": ["GET"],
	"upstream_protocol": "https",
	"type": "roundrobin",
	"plugins": {
		"openid-connect": {
			"client_id": "kbyuFDidLLm280LIwVFiazOqjO3ty8KH",
			"client_secret": "60Op4HFM0I8ajz0WdiStAbziZ-VFQttXuxixHHs2R7r7-CW8GR79l-mmLqMhc-Sa",
			"discovery": "https://samples.auth0.com/.well-known/openid-configuration"
		}
	},
	"script": {},
	"uris": ["/get1"],
	"vars": [],
	"upstream": {
		"type": "roundrobin",
		"nodes": {
			"httpbin.org:443": 1
		},
		"timeout": {
			"connect": 6000,
			"send": 6000,
			"read": 6000
		}
	},
	"upstream_header": {},
	"upstream_path": {
		"to": "/get"
	}
}
  1. visit this route via chrome, got 500 error

2020-10-10 14-52-43屏幕截图

  1. got the error log in apisix error.log:
2020/10/10 06:47:45 [error] 26#26: *6045490 [lua] openidc.lua:1378: authenticate(): request to the redirect_uri path but there's no session state found, client: 192.168.1.145, server: , request: "GET /get HTTP/1.1", host: "192.168.1.145:9
2020/10/10 06:47:45 [error] 26#26: *6045490 [lua] openid-connect.lua:163: phase_func(): failed to authenticate in openidc: request to the redirect_uri path but there's no session state found, client: 192.168.1.145, server: , request: "GET
2020/10/10 06:47:45 [error] 25#25: *6045493 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/plugins/echo.lua:96: attempt to index local 'conf' (a userdata value)
stack traceback:                                                                                                                                            
coroutine 0:                                                                                                                                             
        /usr/local/apisix/apisix/plugins/echo.lua: in function 'phase_fun'                                                                                     
        [string "route#41ee9eef-564e-4208-86e6-fc6834bd7178"]:17: in function 'phase_func'                                                                  
        /usr/local/apisix/apisix/script.lua:52: in function 'run'                                                                                                 
        /usr/local/apisix/apisix/init.lua:508: in function 'http_access_phase'                                                                                 
        access_by_lua(nginx.conf:173):2: in main chunk, client: 192.168.1.145, server: , request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.145:9080", referrer: "http://192.168.1.145:9080/get"

redirect_uri should be a reqired param in openid-connect plugin

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplugin

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions