微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

登录页面重定向后,如何使Google身份验证功能保留其全名等值

如何解决登录页面重定向后,如何使Google身份验证功能保留其全名等值

以下是用于Google身份验证的功能,但我希望在用户成功重定向到主页后保留这些值,以便能够显示用户的简历以个性化用户。但是,每次将页面重定向首页或其他页面时,值往往会丢失。

如何使值在重新加载后仍保留?

function onSignIn(googleUser) {
      
  const profile = googleUser.getBasicProfile();
  console.log('ID: ' + profile.getId(),{ sameSite: 'none',secure: true }); 
  console.log('Full Name: ' + profile.getName(),secure: true }); 
  console.log('Image URL: ' + profile.getimageUrl(),secure: true }); 
  console.log('Email: ' + profile.getEmail(),secure: true }); 

  // Encrypted token passed to back end for security purpose:

  const id_token = googleUser.getAuthResponse().id_token;
  console.log('ID Token: ' + id_token);


  window.location.href = '/home.html';
    

}; 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。