kevin51jiang / react-spotify-auth

Easy Spotify Authentication, written in React
42 stars 18 forks source link

CORS issue when embedding app in iframe #55

Closed ffleandro closed 3 years ago

ffleandro commented 3 years ago

I can't use this library in a react app embedded in an iframe due to CORS issues. Why does getHash needs to access window.parent? https://github.com/kevin51jiang/react-spotify-auth/blob/a280a515847837faacf2b3362ef4417f5fecb226/src/getHash.js#L3

Uncaught DOMException: Blocked a frame with origin "my-iframe-source-url" from accessing a cross-origin frame.

ffleandro commented 3 years ago

Can we use window.location.hash instead of window.parent.location.hash. Just checked here locally and it seems to return the same result.

kevin51jiang commented 3 years ago

Sounds good I'll change it

ffleandro commented 3 years ago

Spotify also doesn't allow embedding their SSO form in an iframe. I've added this feature and can push all of this into a PR for your review today.

kevin51jiang commented 3 years ago

Fixed by #56