"The access token is missing" when calling a GET with key-auth

1,512 views
Skip to first unread message

Azotherian D

unread,
Mar 31, 2017, 6:08:39 PM3/31/17
to Kong
I am trying to finish up the getting started guide, and I am stuck on verifying that a consumers credentials are valid. I have added the key-auth to the consumer, but when I go to do this line:

curl -i -X GET --url http://localhost:8000 --header "Host: example.com" --header "apikey: ENTER_KEY_HERE" (I use the apikey that I created in the previous step)

and I get this error:  

HTTP/1.1 401 Unauthorized Date: Fri, 31 Mar 2017 22:07:31 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Server: kong/0.10.1 WWW-Authenticate: Bearer realm="service" {"error_description":"The access token is missing","error":"invalid_request"}

I have looked through the docs and even on the issues, and nothing is coming up being able to help me. If anyone has any idea on how to fix this, I am gladly open to suggestions. Thank you for your time.

Cooper Marcus

unread,
Mar 31, 2017, 6:14:42 PM3/31/17
to Azotherian D, Kong
Hi,
Can you clarify where in either this process https://getkong.org/docs/0.10.x/getting-started/enabling-plugins/ or in this document https://getkong.org/plugins/key-authentication/ you are encountering an issue?

And/or can you add the calls and responses you made, that did work correctly, before you got to the step in which you are getting stuck?

Thanks, Cooper

--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+unsubscribe@googlegroups.com.
To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.
To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/8129a5e2-71b5-4ce5-9bf7-b475a740dafc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Azotherian D

unread,
Mar 31, 2017, 6:22:32 PM3/31/17
to Kong, gearsf...@gmail.com
Thank you for the quick reply! I have completed the enabling plugins, and I was on the next page after that. Here are the calls I have made up to that point from this page: https://getkong.org/docs/0.10.x/getting-started/enabling-plugins/

curl -i -X POST --url http://localhost:8001/consumers/ --data "username=Jason" (I got the proper response back, as it says on this page: https://getkong.org/docs/0.10.x/getting-started/adding-consumers/
curl -i -X POST --url http://localhost:8001/consumers/Jason/key-auth/ --data 'key=json'

but when I go to verify the user's key by calling curl -i -X GET --url http://localhost:8000 --header "Host: example.com" --header "apikey: json"

I get this exact message:

HTTP/1.1 401 Unauthorized
Date: Fri, 31 Mar 2017 22:07:31 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.10.1
WWW-Authenticate: Bearer realm="service"

{"error_description":"The access token is missing","error":"invalid_request"}

On Friday, March 31, 2017 at 4:14:42 PM UTC-6, Cooper Marcus wrote:
Hi,
Can you clarify where in either this process https://getkong.org/docs/0.10.x/getting-started/enabling-plugins/ or in this document https://getkong.org/plugins/key-authentication/ you are encountering an issue?

And/or can you add the calls and responses you made, that did work correctly, before you got to the step in which you are getting stuck?

Thanks, Cooper
On Fri, Mar 31, 2017 at 3:08 PM, Azotherian D <gearsf...@gmail.com> wrote:
I am trying to finish up the getting started guide, and I am stuck on verifying that a consumers credentials are valid. I have added the key-auth to the consumer, but when I go to do this line:

curl -i -X GET --url http://localhost:8000 --header "Host: example.com" --header "apikey: ENTER_KEY_HERE" (I use the apikey that I created in the previous step)

and I get this error:  

HTTP/1.1 401 Unauthorized Date: Fri, 31 Mar 2017 22:07:31 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Server: kong/0.10.1 WWW-Authenticate: Bearer realm="service" {"error_description":"The access token is missing","error":"invalid_request"}

I have looked through the docs and even on the issues, and nothing is coming up being able to help me. If anyone has any idea on how to fix this, I am gladly open to suggestions. Thank you for your time.

--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com.

Azotherian D

unread,
Apr 3, 2017, 10:06:01 AM4/3/17
to Kong, gearsf...@gmail.com
Would you still be available to help my understand why I can't get the key-auth to work?


On Friday, March 31, 2017 at 4:14:42 PM UTC-6, Cooper Marcus wrote:
Hi,
Can you clarify where in either this process https://getkong.org/docs/0.10.x/getting-started/enabling-plugins/ or in this document https://getkong.org/plugins/key-authentication/ you are encountering an issue?

And/or can you add the calls and responses you made, that did work correctly, before you got to the step in which you are getting stuck?

Thanks, Cooper
On Fri, Mar 31, 2017 at 3:08 PM, Azotherian D <gearsf...@gmail.com> wrote:
I am trying to finish up the getting started guide, and I am stuck on verifying that a consumers credentials are valid. I have added the key-auth to the consumer, but when I go to do this line:

curl -i -X GET --url http://localhost:8000 --header "Host: example.com" --header "apikey: ENTER_KEY_HERE" (I use the apikey that I created in the previous step)

and I get this error:  

HTTP/1.1 401 Unauthorized Date: Fri, 31 Mar 2017 22:07:31 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Server: kong/0.10.1 WWW-Authenticate: Bearer realm="service" {"error_description":"The access token is missing","error":"invalid_request"}

I have looked through the docs and even on the issues, and nothing is coming up being able to help me. If anyone has any idea on how to fix this, I am gladly open to suggestions. Thank you for your time.

--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com.

Thibault Charbonnier

unread,
Apr 3, 2017, 1:24:33 PM4/3/17
to kong...@googlegroups.com
It seems you also added the 'oauth2' plugin on that API. Remove this plugin if you don't intend to use it.

Thibault
-- You received this message because you are subscribed to the Google Groups "Kong" group. To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com. To post to this group, send email to kong...@googlegroups.com. Visit this group at https://groups.google.com/group/konglayer. To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/2d54b90d-5a45-425f-b62d-b329b862f273%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages