Http:403 Forbidden Error When Trying To Load Img Src With Google Profile Pic
Solution 1:
Using referrerpolicy="no-referrer"
seems to help. While it didn't work in a localhost app (before I added this attribute), it worked consistently when loading the image in its own tab. One of the differences in the request headers was the absence of referer
.
Solution 2:
I was getting this error when accessing the localhost without any protocol mentioned. If your images aren't loading, try reopening the website giving http:// or https:// That should solve the issue
Solution 3:
Looks like google doesn't serve requests when the Referer header is set to localhost. I changed it in the inspecto to some other domain, resent it and it worked. I could even get the profile picture with curl and zero headers.
Solution 4:
I could imagine that the URL is dynamically created each time you request it. That is supported by the fact that the user needs to be authenticated to retrieve that URL. (If the user e.g. signs out of a previously authorized service / revokes the authentication, a service should no longer be able to retrieve the profile picture)
So either you store the entire image as a blob in the database or authenticate and use the User Object each time to request the URL.
Also, consider using the API as referenced here.
Solution 5:
2021 same issue
If you are using the CORS plugin on browser(chrome), please turn it off.
After off the plugin, restart your browser and try again.
.. it works for me!
Post a Comment for "Http:403 Forbidden Error When Trying To Load Img Src With Google Profile Pic"