Access to this API has been disallowed

Hi,

I am using Ubuntu 16.04.1 LTS.

I have configured the API via the API File in /opt/tyk-gateway/apps/api1.json as follows:
cat /opt/tyk-gateway/apps/api1.json
{
“name”: “Test API”,
“slug”: “test-api”,
“api_id”: “1”,
“org_id”: “1”,
“auth”: {
“auth_header_name”: “Authorization”
},
“definition”: {
“location”: “header”,
“key”: “x-api-version”
},
“version_data”: {
“not_versioned”: true,
“versions”: {
“Default”: {
“name”: “Default”,
“use_extended_paths”: true
}
}
},
“proxy”: {
“listen_path”: “/test-api/”,
“target_url”: “http://localhost:80/”,
“strip_listen_path”: true
},
“active”: true
}

Generated the API token as well.

But when I try to query this API, I get the error “Access to this API has been disallowed” as follows:
curl -v -H “x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7” -H “Authorization: 1f55572320f4b4f0750b8bbc0360f0988” -s http://localhost:8080/test-api/

  • Trying ::1…
  • Connected to localhost (::1) port 8080 (#0)

GET /test-api/ HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.47.0
Accept: /
x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7
Authorization: 1f55572320f4b4f0750b8bbc0360f0988

< HTTP/1.1 403 Forbidden
< Connection: close
< Content-Type: application/json
< X-Generator: tyk.io
< Date: Mon, 30 Jan 2017 20:50:08 GMT
< Content-Length: 57
<
{
“error”: “Access to this API has been disallowed”

  • Closing connection 0

I am running the tyk-gateway in the debug mode and see the following log messages:
Jan 30 15:50:08] DEBUG Querying local cache
[Jan 30 15:50:08] DEBUG Querying keystore
[Jan 30 15:50:08] DEBUG STORE: Getting WAS: 1f55572320f4b4f0750b8bbc0360f0988
[Jan 30 15:50:08] DEBUG Input key was: apikey-9dda917c
[Jan 30 15:50:08] DEBUG STORE: Getting: apikey-9dda917c
[Jan 30 15:50:08] DEBUG Input key was: apikey-9dda917c
[Jan 30 15:50:08] DEBUG → Got key
[Jan 30 15:50:08] INFO Attempted access to unauthorised API. api_found=false key=1f55572320f4b4f0750b8bbc0360f0988 origin=[ path=/test-api/
[Jan 30 15:50:08] ERROR gateway: request error: Access to this API has been disallowed api_id=1 org_id=1 path=/test-api/ server_name=http://localhost:80/ user_id= user_ip=::1
[Jan 30 15:50:08] DEBUG Returning error header

Can you please me understand what I’m missing?

Thanks,
Poojan.

Hi, you don’t really need x-tyk-authorization on this case (this is a header we use for the Tyk Gateway API).

How did you create the token? The error seems to be related to the token permissions.

Best.