Microgateway working even without Oauth token in header

edge-mg-oauth-issue.pngI am trying to set-up Microgateway in my machine and work on some custom plugin. Though i enabled OAuth as follows in ~/.edgemicro/*-config.yaml

oauth:

allowNoAuthorization: false

allowInvalidAuthorization: false

Still seeing positive response in terminal

curl -i http://vidheergadikota-6bb4cfe1-eval-test.apigee.net/hello/echo

HTTP/1.1 200 OK

Date: Wed, 06 Dec 2017 12:15:40 GMT

Content-Type: application/json; charset=utf-8

Content-Length: 247

Connection: keep-alive

Access-Control-Allow-Origin: *

ETag: W/"f7-FUsaHPKO9732WFgV0R66zg"

X-Powered-By: Apigee

Server: Apigee Router

{"headers":{"host":"mocktarget.apigee.net","accept":"*/*","user-agent":"curl/7.54.0","x-forwarded-for":"24.0.181.237, 104.198.35.174","x-forwarded-port":"80","x-forwarded-proto":"http","connection":"keep-alive"},"method":"GET","url":"/","body":""}

Solved Solved
0 6 287
1 ACCEPTED SOLUTION

@vgadikota ... Make sure you have /** in the Resource Path in the Product Definition of the edgemicro_hello.

View solution in original post

6 REPLIES 6

Former Community Member
Not applicable

It appears you're accessing the API Proxy hosted on Apigee Edge and not microgateway. To access the same service on Microgateway, try

curl -v http://localhost:8000/hello/echo 

@srinandans Appreciate your help! When i used localhost, getting 403 error. am i missing anything?

curl -i -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjEifQ.eyJhcGlfcHJvZHVjdF9saXN0IjpbIkVkZ2VNaWNyb1Rlc3RQcm9kdWN0Il0sImF1ZGllbmNlIjoibWljcm9nYXRld2F5IiwianRpIjoiNGNlNDhhNjktNWQ5OS00NDQzLWE4ZDAtOGY5ZTFkNmJmMTBiIiwiaXNzIjoiaHR0cHM6Ly92Z2FkaWtvdGEtZXZhbC10ZXN0LmFwaWdlZS5uZXQvZWRnZW1pY3JvLWF1dGgvdG9rZW4iLCJhY2Nlc3NfdG9rZW4iOiJsNEhnVWsyWEk2b25teWg3N3BhT1ljYTVxVElCIiwiY2xpZW50X2lkIjoiRVFySEJSR1diMjFCaUpVMVp3cExQRE1VVWRMa0JiclEiLCJuYmYiOjE1MTI1ODU5MTMsImlhdCI6MTUxMjU4NTkxMywiYXBwbGljYXRpb25fbmFtZSI6ImQ4NGUzN2FmLTM0MGYtNDc1YS04YTE1LTAyMzBjMzhiMzNiYiIsInNjb3BlcyI6WyIiXSwiZXhwIjoxNTEyNTg2MjEzfQ.UTnVDrr0DFMP3uSVV0WAAH3u-1JO4-7ik-djqkKfpmcYVJre4W1UCQtd6IT-vSIOepti0TQ1FHVl8gG0o9T__TwCRRyHnZHi0EGfmXcU6lQ95vYq7r_1sep4hXajPloGA6vbcQXEeFU0fEDLSNyuXfvizQHqpB56QpyCUqSxa2MvVsvG5xEbZoCulQdU3tonnxa5lZzgsqw4oXgmotKKyLTczG_mhfDwUUXmCk33_14htfzieDGx-XJ9a1mmqdNYVeGAkPYGmISXHLUQXLMyJxAY78K5dI1RM0CuQNWB6Q8s_Cvfpo1W9G-rndzWjJf_9SWtW1d8K4NhvDoBHy2TCQ" http://localhost:8000/hello/echo

HTTP/1.1 403 Forbidden

content-type: application/json

Date: Wed, 06 Dec 2017 18:46:41 GMT

Connection: keep-alive

Content-Length: 25

Hi @vgadikota, I am not sure what went wrong, may be try with a new JWT token. Generally it expires in 5 mins.

@Vidheer Gadikota , perform edgemicro reload, check the status and give a try with new token .

@vgadikota ... Make sure you have /** in the Resource Path in the Product Definition of the edgemicro_hello.

Thank you @rakeshapi. It resolved the issue. I think edge micro gateway documentation in following page also needs this correction, it says to add "/" for resources

https://docs.apigee.com/microgateway/latest/setting-and-configuring-edge-microgateway

Resources:

  • API Proxy: Select edgemicro_hello AND edgemicro-auth.
  • Revision: 1
  • Resource Path: /