Request Cycle is as follows:
1: GET https://{cfDistro}.cloudfront.net/
Returns a 302 redirect to this url:
https://{oktaDomain}..okta.com/oauth2/v1/authorize?client_id={clientId}&response_type=code&scope=openid%20email&redirect_uri=https{cfDistro}.cloudfront.net%2Fcallback&nonce={nonce}&state=%2Findex.html
Sign into the Okta Login Page
Okta redirects to this URL:
https://d3f25n2hc0m1s1.cloudfront.net/callback?code={code}&state=%2Findex.html
The No Code Found Error 401 page populates
Is there something Im missing with my cloudfront setup? This looks to me to be an issue with the lambda function getting the code from the queryString but I am failing to see what could be wrong there.
UPDATE I managed to figure out Lambda@Edge logging and i am getting a 400 response from Okta
Requesting access token.
Internal server error2: Request failed with status code 400
When logging the request, code is missing.
It looks like the event being received by the mainFunction is a request to the underlying S3 bucket and the querystring is being dropped
Looks like my cloudfront had the Lambda@Edge function being triggered on an origin request - which doesnt contain the necessary headers. When the Lambda@Edge is deployed it needs to be deployed to trigger on VIEWER requests.
Getting a 401 Unauthorized - No Code Found issue, but the
code
query param is present in the redirect made by Okta to my CF Cloudfront URLconfig.json:
Request Cycle is as follows: 1: GET
https://{cfDistro}.cloudfront.net/
https://{oktaDomain}..okta.com/oauth2/v1/authorize?client_id={clientId}&response_type=code&scope=openid%20email&redirect_uri=https{cfDistro}.cloudfront.net%2Fcallback&nonce={nonce}&state=%2Findex.html
https://d3f25n2hc0m1s1.cloudfront.net/callback?code={code}&state=%2Findex.html
No Code Found Error 401
page populatesIs there something Im missing with my cloudfront setup? This looks to me to be an issue with the lambda function getting the
code
from the queryString but I am failing to see what could be wrong there.UPDATE I managed to figure out Lambda@Edge logging and i am getting a 400 response from Okta
When logging the request,
code
is missing.It looks like the
event
being received by themainFunction
is a request to the underlying S3 bucket and the querystring is being droppedANOTHER UPDATE
Looks like my cloudfront had the Lambda@Edge function being triggered on an origin request - which doesnt contain the necessary headers. When the Lambda@Edge is deployed it needs to be deployed to trigger on VIEWER requests.