-
Notifications
You must be signed in to change notification settings - Fork 301
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
Rendering images on Azure Web App from SharePoint Document Library #1876
Comments
Hi @freyes17, thanks for posting an issue! This is non-library one, actually. But the behaviour - when you have not been visiting SP site these images are unavailable with 401 or not cached. Please check what you see in the browser network console. The images requests fails with 401, not authenticated. Anyways, it's architecturally incorrect to link images cross-resources not holding authentication. It's better think out moving images to a resource which is accessible from within your app or publicly through CDN for example. |
Thank you for your help. I appreciate the feedback. Just to clarify I don't seem to be getting a 401 error. I do get a 302 warning with the following in the request. console tab When visiting the site I never visit the actual images in the Document Binder. I just visit the site https://site.sharepoint.com/sites/examplesite and it works after triggering the visit. So I don't think it is caching the actual image. Not sure if this changes anything. Either way, thank you. |
302 is a redirect, so while not having a cookie a resource redirects to the login page, but as it’s a src in an img tag - no actual redirect. The recommendation is still publishing assets to the app infra, server-side proxying, or configuring CDN (if anonymous exposure is an option). For the CDN please check this doc. |
Closing this issue as answered. If you have additional questions or we did not answer your question, please open a new issue, ref this issue, and provide any additional details available. Thank you! |
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked. |
Category
Version
Please specify what version of the library you are using: [ 2.0.0 ]
Please specify what version(s) of SharePoint you are targeting: [ SharePoint Online ]
If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.
Question
I am creating an Azure Web App that pulls data from SharePoint Online. Without issues, I am able to request the images from the document library but can't render them into the web page until I open a new tab directly visiting the SharePoint site. After I visit the site, the images I pulled now properly display on the Azure Web App.
When I don't visit the SharePoint site first.
![image](https://user-images.githubusercontent.com/26288238/132877543-489e2221-a4f2-4392-819c-598a704ed41f.png)
After I visit the SharePoint site on a different tab.
![image](https://user-images.githubusercontent.com/26288238/132877717-43a8a6fd-0398-4f05-aa2f-7bfdf8881720.png)
I am using @azure/msal-browser v2.14.1 to authenticate if that information is useful.
Any possible work around? or recommendations?
Thank you in advance for any suggestions.
The text was updated successfully, but these errors were encountered: