我希望有人可以帮我找到一种方法,通过我的Facebook身份验证使用Firebase获得更高分辨率的个人资料图片。 Angularfire。
现在一切正常。我将以下权限传递给Firebase:"public_profile, user_friends, email"
,因为它们不需要Facebook审核。我的应用程序仍在开发中,尚未为该部分做好准备。
我做了什么:
public_profile
权限确实为我提供了安全图片,但设置为100x100px(https://scontent.xx.fbcdn.net/hprofile-xfp1/v/t1.0-1/p100x100..。)
我也面临与Twitter相同的问题,但我会对此表示不满。 Google为您提供了一个很棒的形象。
我正在使用最新的稳定版本。
有没有人知道如何在Angular / Firebase情况下获得更高质量的图片?我愿意接受任何建议/解决方法。
如果有帮助,请参阅我的身份验证服务中的一些代码:
function socialLogin(provider, options) {
// prefer pop-ups, so we don't navigate away from the page
return fbAuth.$authWithOAuthPopup(provider, options).then(function(authData) {
// user authenticated with Firebase, create "users" data profile.
setUserProfile(provider, authData, _timeStamp, _timeStamp);
}).catch(function(error) {
// fall-back to browser redirects, and pick up the session
// automatically when we come back to the origin page
if (error.code === "TRANSPORT_UNAVAILABLE") {
return fbAuth.$authWithOAuthRedirect(provider).then(function(authData) {
// user authenticated with Firebase, create "users" data profile.
setUserProfile(provider, authData, _timeStamp, _timeStamp);
}).then(function() {
// Never called because of page redirect
}).catch(function(error) {
// bad stuff happened :(
showError(error);
});
} else {
// bad stuff happened :(
showError(error);
}
});
}
function setUserProfile(provider, authData, updatedAt, lastLoggedInAt) {
switch (provider) {
case "google":
return createUserProfile(googleUserObject(authData, updatedAt, lastLoggedInAt), authData);
case "twitter":
return createUserProfile(twitterUserObject(authData, updatedAt, lastLoggedInAt), authData);
case "facebook":
return createUserProfile(facebookUserObject(authData, updatedAt, lastLoggedInAt), authData);
}
}
function createUserProfile(userObject, authData) {
var ref = fbUtilities.ref("users", authData.authGroup);
ref.once("value", function(snapshot) {
var existsAuthGroup = (snapshot.val() !== null);
if (!existsAuthGroup) {
fbUtilities.handler(function(cb) {
authData = ref.set(userObject, cb);
});
}
});
}
function facebookUserObject(user, updatedAt, lastLoggedInAt) {
return {
key: user.uid,
provider: user.provider,
token: user.token,
auth: user.auth,
expires: user.expires,
facebook: user.facebook,
facebookId: user.facebook.id,
accessToken: user.facebook.accessToken,
name: user.facebook.displayName,
email: user.facebook.email,
picture: user.facebook.profileImageURL,
cachedUserProfile: user.facebook.cachedUserProfile,
createdAt: _timeStamp,
updatedAt: updatedAt,
lastLoggedInAt: lastLoggedInAt
};
}
socialLogin()参数:
@provider = facebook, twitter, or google.
@options = "public_profile, user_friends, email" (if @provider === facebook)
我感谢任何帮助。谢谢!