openedx / openedx/frontend-app-authoring
CORS errors when entering directly MFE host through the browser and not by redirections
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 218
- Avg merge
- 9d 20h
- Merged PRs (30d)
- 20
Description
Description
When opening the https://apps.redwood.demo.edly.io/course-authoring/home directly w/o opening the https://studio.redwood.demo.edly.io and then being redirected, a CORS error is raised when trying to use the MFE. In this case the MFE doing the request for oauth2 to login into the studio and failed because of CORS. When I'm opening the Studio MFE from studio.redwood.demo.edly.io I became a logged in user and the login flow from MFE is not triggered.
Expected behavior
Request to became a Course creator is sent, an appropriate message is displayed
Actual behavior
I get an error Sorry, there was error with you request.
Console logs:
home:1 Access to XMLHttpRequest at 'https://redwood.demo.edly.io/oauth2/authorize?client_id=cms-sso&redirect_uri=https%3A%2F%2Fstudio.redwood.demo.edly.io%2Fcomplete%2Fedx-oauth2%2F%3Fredirect_state%3DnWpdAjq4Qqrjji7z9koTja6UvhjoviKz&state=nWpdAjq4Qqrjji7z9koTja6UvhjoviKz&response_type=code&scope=user_id+profile+email' (redirected from 'https://studio.redwood.demo.edly.io/request_course_creator') from origin 'https://apps.redwood.demo.edly.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
header is present on the requested resource.
Steps to reproduce
- Register a new User
- Open Studio https://apps.redwood.demo.edly.io/course-authoring/home
- Click on
Becoming a course creator in Studioarea below the textAre you staff on an existing Studio course? The course creator must give you access to the course. Contact the course creator or administrator for the course you are helping to author. - Click on
Request the abillity to create coursesbutton.
Original issue: https://github.com/openedx/wg-build-test-release/issues/379
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Course Creator request flow entered through the request_course_creator endpoint and reproduce it by opening the Course Authoring MFE directly. Compare that path with the Studio redirect flow, using the browser console error and the OAuth2 authorization request as guides. Done means a direct MFE visit can request course-creator access and display the appropriate message without the CORS failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100