I’m using Tyk OSS gateway and I’m trying to set up JWT scope to policy mapping but it is not working with the error
{
“error”: “key not authorized: no matching policy found”
}
API definition:
{
“name”: “test”,
“api_id”: “1”,
“org_id”: “”,
“auth”: {
“auth_header_name”: “Authorization”
},
“enable_jwt”: true,
“jwt_signing_method”: “rsa”,
“jwt_source”: “jwks url”,
“jwt_identity_base_field”: “sub”,
“jwt_scope_claim_name”: “scope”,
“jwt_scope_to_policy_mapping”: {
“test/read”: “test”
},
“jwt_default_policies”: [],
Policy definition:
"id": "test",
"name": "test",
"allowance": 1,
"rate": 1,
"per": 5,
"access_rights": {
"1": {
"api_name": "<name>",
"api_id": "1",
"versions": ["Default"]
}
},
"active": true
Partial logs:
tyk-gateway_1 | time=“Apr 18 07:27:50” level=debug msg=“Querying authstore” api_id=1 api_name=“” mw=JWTMiddleware org_id= origin=192.168.144.1 path=/graphql
tyk-gateway_1 | time=“Apr 18 07:27:50” level=debug msg=“Could not get session detail, key not found” err=“key not found” inbound-key=“****1071” prefix=auth-mgr
tyk-gateway_1 | time=“Apr 18 07:27:50” level=debug msg=“Key does not exist, creating” api_id=1 api_name=“” mw=JWTMiddleware org_id= origin=192.168.144.1 path=/graphql
tyk-gateway_1 | time=“Apr 18 07:27:50” level=debug msg=“EVENT FIRED: AuthFailure”