使用 google 登录获取大头像
Login with google get large profile picture
我正在使用此代码在我的网站上实现 google 登录。
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}
</script>
但我在控制台中收到了小头像。我怎样才能从 google 获得最大个人资料照片的 url?
将查询参数添加到图片网址 ?sz=x,其中 x 是您的图片大小。
基本回答到这里
Retrieving profile image from Google+ API
我正在使用此代码在我的网站上实现 google 登录。
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}
</script>
但我在控制台中收到了小头像。我怎样才能从 google 获得最大个人资料照片的 url?
将查询参数添加到图片网址 ?sz=x,其中 x 是您的图片大小。
基本回答到这里
Retrieving profile image from Google+ API