enzostvs HF Staff commited on
Commit
71fcc87
·
1 Parent(s): 73322f4

login through iframe

Browse files
Files changed (2) hide show
  1. hooks/useUser.ts +5 -3
  2. lib/seo.ts +0 -2
hooks/useUser.ts CHANGED
@@ -79,19 +79,21 @@ export const useUser = (initialData?: {
79
  const expiresDate = new Date();
80
  expiresDate.setTime(expiresDate.getTime() + expiresIn * 1000);
81
 
 
 
82
  const cookieOptions: any = {
83
  expires: expiresDate,
84
  path: '/',
85
- sameSite: 'lax',
86
  };
87
 
88
- if (window.location.protocol === 'https:') {
89
  cookieOptions.secure = true;
90
  }
91
 
92
  setToken(res.data.access_token, cookieOptions);
93
 
94
- const cookieString = `${MY_TOKEN_KEY()}=${res.data.access_token}; path=/; max-age=${expiresIn}; samesite=lax${cookieOptions.secure ? '; secure' : ''}`;
95
  document.cookie = cookieString;
96
 
97
  refetchMe();
 
79
  const expiresDate = new Date();
80
  expiresDate.setTime(expiresDate.getTime() + expiresIn * 1000);
81
 
82
+ const isProduction = window.location.protocol === 'https:';
83
+
84
  const cookieOptions: any = {
85
  expires: expiresDate,
86
  path: '/',
87
+ sameSite: isProduction ? 'none' : 'lax',
88
  };
89
 
90
+ if (isProduction) {
91
  cookieOptions.secure = true;
92
  }
93
 
94
  setToken(res.data.access_token, cookieOptions);
95
 
96
+ const cookieString = `${MY_TOKEN_KEY()}=${res.data.access_token}; path=/; max-age=${expiresIn}; samesite=${isProduction ? 'none' : 'lax'}${cookieOptions.secure ? '; secure' : ''}`;
97
  document.cookie = cookieString;
98
 
99
  refetchMe();
lib/seo.ts CHANGED
@@ -74,8 +74,6 @@ export function generateSEO({
74
  creator: "@deepsite",
75
  },
76
  other: {
77
- // Prevent iframe embedding from unauthorized domains
78
- 'X-Frame-Options': 'SAMEORIGIN',
79
  // Control how the page appears when shared
80
  'og:image:secure_url': `${baseUrl}${image}`,
81
  // Help search engines understand the primary URL
 
74
  creator: "@deepsite",
75
  },
76
  other: {
 
 
77
  // Control how the page appears when shared
78
  'og:image:secure_url': `${baseUrl}${image}`,
79
  // Help search engines understand the primary URL