Skip to content

Commit

Permalink
Fix excessive requests to Google on initialisation (#3218)
Browse files Browse the repository at this point in the history
### Purpose 
When a user logs in with google, requests for the Avatar occasionally
fail. After investigation, the issue seems to be caused by Google's API
enforcing stricter restrictions on the Referer header. By adding the
directive referrerpolicy="no-referrer", these restrictions can be
bypassed.
Source:
https://stackoverflow.com/questions/40570117/http403-forbidden-error-when-trying-to-load-img-src-with-google-profile-pic

### Changes
When requesting a Google avatar, add referrerpolicy="no-referrer".

---------

Co-authored-by: Texera <[email protected]>
Co-authored-by: shenghao fu <[email protected]>
Co-authored-by: GspikeHalo <[email protected]>
  • Loading branch information
4 people authored Jan 27, 2025
1 parent d349903 commit 726fe3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/gui/src/app/common/service/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class UserService {

private fetchBlob(url: string): Observable<Blob> {
return new Observable(observer => {
fetch(url)
fetch(url, { referrerPolicy: "no-referrer" })
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand Down

0 comments on commit 726fe3e

Please sign in to comment.