Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass same-origin credentials - fixes #875 #877

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

mikeirvingweb
Copy link
Contributor

passing {credentials: "same-origin"} into fetch() calls made by Bootstrapper.ts (uno-bootstrap.jsin eventual web publish) means that the Uno Platform Wasm App will work on web hosting where we are behind authentication, requiring access to an authentication cookie (such as Azure Static Web Apps 'Password Protection')

addresses, fixes #875

@mikeirvingweb mikeirvingweb changed the title fix: pass same origin credentials - fixes #875 fix: pass same-origin credentials - fixes #875 Jul 19, 2024
Copy link
Member

@carldebilly carldebilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a way to test this.

@mikeirvingweb
Copy link
Contributor Author

@carldebilly stick an app in Azure Static Web Apps (paid), turn on Password Protection in Configuration.

Load your App URL, enter your password, if your app loads then the fix works.

Previously the app would fail to load.

@mikeirvingweb
Copy link
Contributor Author

furthermore @carldebilly

to simulate the deployment, without needing the package change live, publish to a folder, then modify uno-bootstrap.js

  • change omit to same-origin in getFetchInit
  • and in fetchFile, change the return statement to return fetch(asset, {credentials: "same-origin"});

then publish your app using swa deploy

@carldebilly
Copy link
Member

furthermore @carldebilly

to simulate the deployment, without needing the package change live, publish to a folder, then modify uno-bootstrap.js

  • change omit to same-origin in getFetchInit
  • and in fetchFile, change the return statement to return fetch(asset, {credentials: "same-origin"});

then publish your app using swa deploy

My comment was more about the ability to create an automated tests in the project CI to test this instead of having to manually test it.

@jeromelaban
Copy link
Member

Thanks for your contribution! This is likely difficult to validate as-is, but we can definitely try when the dev build will be available. At the very least, the tests passed.

@jeromelaban jeromelaban merged commit 972018d into unoplatform:main Jul 29, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Static Web Apps, with Authentication, WASM fails
3 participants