Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

redirect_uri is fixed to "_/callback" despite setting otherwise during ./build.sh #75

Open
rollue opened this issue Sep 8, 2020 · 0 comments

Comments

@rollue
Copy link

rollue commented Sep 8, 2020

Hi I've been trying to use this library to set up Google Oauth on our S3 bucket - Cloudfront.
Unfortunately, I've been getting "JWT error, unauthorized" message on the log with no JWT being set.
I found via debugging and testing with ngrok that request.uri in Callback Payload is somehow fixed to "/_callback" even though it explicitly set it to https://our-cloudfront's-cname/index.html, during ./build.sh

*/ Callback Payload /*
{
  "Records": [
    {
      "cf": {
        "request": {
          "headers": {
            "host": [ { "value": "example.com", "key": "Host" } ],
            "user-agent": [ { "value": "test-agent", "key": "User-Agent" } ]
          },
          "clientIp": "2001:cdba::3257:9652",
          "uri": "/_callback",
          "method": "GET",
          "querystring": "code=8fce8bc8b73510e11f8c&state=%2f&session_state=fc350b67-673e-4ecd-98e7-3c2f5a875d0a"
        },
        "config": {
          "distributionId": "EXAMPLE",
          "test": "https://9889643ae09c.ngrok.io"
        }
      }
    }
  ]
}

My workaround is:

  1. changing the filename of s3's index.html to _callback
  2. changing redirect on OAuth provider to https://my-cloudfront-cname.com/_callback (I'm using cname because I'm using custom domain)
  3. changing s3 - Properties - Static website hosting - set Index document to _callback
  4. Make sure all files in S3 are set to public, but set OAI from cloudfront for making sure only access from cloudfront is allowed.

It works for now, I cannot figure out why this is happening. Thanks.

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

No branches or pull requests

1 participant