admin管理员组文章数量:1326134
I am using Firebase / Google sign-in authentication to log users in my app. The authentication works perfectly with Gmail account - however, with the accounts of my client, which has a business Gmail account ([email protected]), the authentication works but the user profile picture is not shared (the User object is returned with a default picture, like this one : .jpg ).
For information, I am using the very standard signInWithPopup method :
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then((credential) => {
var authState = credential.user
updateUserData() // Updating user's data })
.catch(error => console.log(error))
So I tried to get around this by finding the profile photos directly on the net, instead of getting it from the authentication, by using id based url, for example like this :
/?alt=json
But the json also returns a default photo for the email adresses with the business account, so this makes me assume there must be some specific privacy settings for this business account which prevent the photos from being shared.
Does any one had this problem already, or has any idea on :
- the settings to be changed on gmail business accounts to enable profile photo sharing?
- if it is possible to make a consent screen, to get the consent of the user to share his basic profile infos with the app (I know the consent screen has been removed recently by Google when the app requires only basic profile informations -name, email, photo, ..-) ?
- a more 'hacky' way to get the photos from the net ?
- any other suggestion ?
I am using Firebase / Google sign-in authentication to log users in my app. The authentication works perfectly with Gmail account - however, with the accounts of my client, which has a business Gmail account ([email protected]), the authentication works but the user profile picture is not shared (the User object is returned with a default picture, like this one : https://lh3.googleusercontent./-9Me77eEe8m0/AAAAAAAAAAI/AAAAAAAAAAA/0uO0KAv-PMQ/photo.jpg ).
For information, I am using the very standard signInWithPopup method :
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then((credential) => {
var authState = credential.user
updateUserData() // Updating user's data })
.catch(error => console.log(error))
So I tried to get around this by finding the profile photos directly on the net, instead of getting it from the authentication, by using id based url, for example like this :
http://picasaweb.google./data/entry/api/user/?alt=json
But the json also returns a default photo for the email adresses with the business account, so this makes me assume there must be some specific privacy settings for this business account which prevent the photos from being shared.
Does any one had this problem already, or has any idea on :
- the settings to be changed on gmail business accounts to enable profile photo sharing?
- if it is possible to make a consent screen, to get the consent of the user to share his basic profile infos with the app (I know the consent screen has been removed recently by Google when the app requires only basic profile informations -name, email, photo, ..-) ?
- a more 'hacky' way to get the photos from the net ?
- any other suggestion ?
1 Answer
Reset to default 8I've been stuck on this same issue for days. This is how I managed to get the correct photo url!
var user = firebase.auth().currentUser;
if (user != null) {
user.providerData.forEach(profile => {
console.log(profile.photoURL);
}); //this will give you all the urls once there is user data
}
Most likely you are loading the dummy url while firebase is still fetching all the user info. You just need to add a check to make sure there is user data before trying to get the urls. I am using my business account too.
本文标签:
版权声明:本文标题:javascript - FirebaseGoogle sign-in authentication : profile photo not retrieved on gmail business account - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742190018a2430037.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论