'Okta: Getting 403 error with Static website hosting on S3

In my setup, I have React app hosted in S3 as static website, served through cloud front distribution and secured through Okta. I do not want to make my S3 bucket publicly available so I have restricting access to Amazon S3 content by using an origin access identity (OAI) from Cloud front. I can successfully launch my application and can redirect my app to Okta sign-in widget but when I get token from okta using implicit/callback, I get access denied error. I do understand this is happening as access to bucket objects are only for /index.html pages but did anyone resolved this issue?



Solution 1:[1]

I have got the same issue, the article Matt Raible is the answer:

If you try to log in, you’ll get a 403 when redirecting back to the site.

To fix this, edit your distribution > Error pages. Create two custom error responses for 404 and 403. Return a path of /index.html and a 200: OK response code.

Got my issues fixed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steven Yong