cloud edgemicro-auth returns 200ok but Laptop Edge Microgateway throws 401

Hello Team, I am trying to setup Edge Microgateway with Apikey, My setup initially worked with Oath token, then I enabled apikey but keep getting  below error.

HTTP/1.1 401 Unauthorized
content-type: application/json
Date: Wed, 25 May 2022 07:21:18 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 25

{"error":"invalid_token"}

any help is highly required and appreciated 

==========================config.yaml============================

apikeys:
cacheKey: true
allowNoAuthorization: false
allowInvalidAuthorization: false
gracePeriod: 9000000000000000 [dint work with 10 the absurd value is for debugging]
api-key-header: "apikey"
verify_api_key_url: 'https://aashishkotagiri-trial-test.apigee.net/edgemicro-auth/verifyApiKey'

 

===================================Apigee edge JWT Response ==========================================

{
"aud": "microgateway",
"api_product_list": [
"edgemicro_Product"
],
"application_name": "edgemicro_App",
"nbf": 1653462940,
"developer_email": "Aashish.kotagiri@emaratech.ae",
"iss": "https://aashishkotagiri-trial-test.apigee.net/edgemicro-auth/verifyApiKey",
"exp": 1653464740,
"iat": 1653462940,
"client_id": "pgWHDusKSN1u9bnEgQP1nmqjlWU6Sq7E",
"jti": "92bcdea4-f3b0-4c8f-b6c1-456af1e76cce"
}

 

========================  edge micro logs =========================

 

2022-05-25T07:14:21.704Z [info][localhost:8000][9][aashishkotagiri-trial][test][linuxwebsite][][][4cb74970-dbfa-11ec-9fe8-9d89d2ae27be][plugins-middleware][sourceRequest][GET][][][][]
2022-05-25T07:14:21.704Z debug 9 Request ID: 4cb74970-dbfa-11ec-9fe8-9d89d2ae27be, preparing plugin map for type 'null' & length - '2'
2022-05-25T07:14:21.705Z debug 9 Request ID: 4cb74970-dbfa-11ec-9fe8-9d89d2ae27be, executing plugin handler 'onrequest' of plugin 'analytics'
2022-05-25T07:14:21.706Z debug 9 Request ID: 4cb74970-dbfa-11ec-9fe8-9d89d2ae27be, callback executed successfully for handler 'onrequest' of plugin 'analytics'
2022-05-25T07:14:21.706Z debug 9 Request ID: 4cb74970-dbfa-11ec-9fe8-9d89d2ae27be, executing plugin handler 'onrequest' of plugin 'apikeys'
2022-05-25T07:14:22.687Z [error][localhost:8000][9][aashishkotagiri-trial][test][linuxwebsite][][][4cb74970-dbfa-11ec-9fe8-9d89d2ae27be][apikeys][][GET][401][auth failure][][]
2022-05-25T07:14:22.688Z debug 9 Request ID: 4cb74970-dbfa-11ec-9fe8-9d89d2ae27be, callback executed successfully for handler 'onrequest' of plugin 'apikeys'
2022-05-25T07:14:22.688Z [error][localhost:8000][9][aashishkotagiri-trial][test][linuxwebsite][][][4cb74970-dbfa-11ec-9fe8-9d89d2ae27be][plugins-middleware][source request failed.][GET][401][][][]
2022-05-25T07:14:22.688Z [error][localhost:8000][9][aashishkotagiri-trial][test][linuxwebsite][][][4cb74970-dbfa-11ec-9fe8-9d89d2ae27be][microgateway-core][][GET][401][][][]

Solved Solved
1 1 58
1 ACCEPTED SOLUTION

Turns out We can keep the Oauth plugin and use X-Api-Key header to make the microgateway  authenticate with apikey... I should have red the documentation fully before posting 🙂 

View solution in original post

1 REPLY 1

Turns out We can keep the Oauth plugin and use X-Api-Key header to make the microgateway  authenticate with apikey... I should have red the documentation fully before posting 🙂