From c91a1d4ed989fea0ea1837e6f829c8ab392ed84b Mon Sep 17 00:00:00 2001 From: haoliu Date: Tue, 26 Feb 2019 15:11:12 +0800 Subject: [PATCH] [TMA-630][haoliu & llr] Get right response_body --- kong/plugins/okta-auth/okta_api.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kong/plugins/okta-auth/okta_api.lua b/kong/plugins/okta-auth/okta_api.lua index a9119b4..e5c6a4d 100644 --- a/kong/plugins/okta-auth/okta_api.lua +++ b/kong/plugins/okta-auth/okta_api.lua @@ -74,12 +74,11 @@ local function fetch_objc_label(oidc_id) for key, value in pairs(response_body) do ngx.log(ngx.DEBUG, key, value) end + return response_body.label else - ngx.log(ngx.DEBUG, "Get Response Success response_body: ", response_body) + ngx.log(ngx.ERR, "Get Response Failed with wrong formatted") + return nil end - - local oidc = response_body[1] or response_body - return oidc.label end function _M.get_oidc_label(oidc_id)