Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hands ON 2.4 - Oauth Issues #3

Open
mlarizzate opened this issue May 9, 2024 · 2 comments
Open

Hands ON 2.4 - Oauth Issues #3

mlarizzate opened this issue May 9, 2024 · 2 comments

Comments

@mlarizzate
Copy link

Hi Siddharth!
First of all thank you for taking the time to teach, your course is very well designed and all the steps are very clear.

I would like to report you that the authentication for reservations API is not working.

From Studio I'm getting 404 Error

Global.xml config

<os:object-store name="oauthTokenObjectStore" doc:name="Object store" doc:id="73b7eefd-95c8-4308-9ee4-45fa7c32c15e" entryTtl="60" entryTtlUnit="MINUTES" expirationInterval="60" />
	<http:request-config name="bookingDataByBID" doc:name="HTTP Request configuration" doc:id="72e7570b-e2d6-47d2-bae2-4f31e6de555a" basePath="/booking" >
		<http:request-connection protocol="HTTPS" host="onlineman477-eval-prod.apigee.net" port="443" >
			<http:authentication >
				<oauth:client-credentials-grant-type clientId="KZ25TpHNeppVOmwtKpD6jQAjnq4vrLG1" clientSecret="CYBpVYhSeqSy4GSR" tokenUrl="https://onlineman477-eval-prod.apigee.net/owasp-oauth/token" >
					<oauth:token-manager objectStore="oauthTokenObjectStore" />
				</oauth:client-credentials-grant-type>
			</http:authentication>
		</http:request-connection>
	</http:request-config>

Received Error

"Error response when calling token URL 'https://onlineman477-eval-prod.apigee.net/owasp-oauth/token'. Response was:
DefaultHttpResponse {
  responseStatus: 404 (Not Found),
  headers: MultiMap{[date=[Thu, 09 May 2024 12:56:39 GMT], content-type=[text/html], content-length=[344], connection=[keep-alive], etag=["60adabf8-158"], x-frame-options=[DENY], x-xss-protection=[1], x-content-type-options=[nosniff], strict-transport-security=[max-age=86400], content-security-policy=[frame-ancestors 'none']]}
}
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
</body>
</html>
"

From POSTMAN I'm getting 502 Bad Gateway

image

From CURL I'm getting 502 Bad Gateway

I'm using curl command placed into hands-on-solutions/Section2/2.4/OAuth_Details.txt

➜  --request POST 'https://onlineman477-eval-prod.apigee.net/owasp-oauth/token' \
--header 'Authorization: Basic S1oyNVRwSE5lcHBWT213dEtwRDZqUUFqbnE0dnJMRzE6Q1lCcFZZaFNlcVN5NEdTUg==' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials'
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
</body>
</html>

Hope to help to fix and improve the experience!

@mlarizzate
Copy link
Author

As discussed with the @sidd-harth this is the fix until he could update the video and code:

curl --location --request POST 'http://booking-oauth-api.us-e2.cloudhub.io/token'
--header 'client_id: KZ25TpHNeppVOmwtKpD6jQAjnq4vrLG1'
--header 'client_secret: CYBpVYhSeqSy4GSR'
--header 'grant_type: client_credentials'

token endpoint - http://booking-oauth-api.us-e2.cloudhub.io/token
client id - KZ25TpHNeppVOmwtKpD6jQAjnq4vrLG1
client secret - CYBpVYhSeqSy4GSR

backend url - http://booking-oauth-api.us-e2.cloudhub.io/booking/BID7890

Note: it works with http and port 80

@mlarizzate
Copy link
Author

The last solution is failing too
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant