Hello,
I was able to successfully implement Google Sign in with Firebase Auth for my game. I was able to print the following without any issues
FirebaseUser.DisplayName
FirebaseUser.PhotoUrl
FirebaseUser.userId
However, while trying to download the firebaseuser profile image using FirebaseUser.PhotoUrl always returns a 400 Bad Request. Here's the code I am using to download the image
IEnumerator SetProfilePic()
{
Debug.Log("Starting IENUM.....");
UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture(FirebaseUser.PhotoUrl);
yield return webRequest.SendWebRequest();
if (webRequest.result == UnityWebRequest.Result.Success)
{
Texture profileImageTexture = DownloadHandlerTexture.GetContent(webRequest);
Sprite sprite = Sprite.Create((Texture2D)profileImageTexture, new Rect(0, 0, profileImageTexture.width, profileImageTexture.height), new Vector2(0.5f, 0.5f));
profileImage.GetComponent().sprite = sprite;
}
else
{
Debug.Log(webRequest.error);
}
}
The Debug.Log("Starting IEnum"); prints just fine. But the www request always fails with a 500 bad request.
I am not sure if I am missing an authorization header or token for downloading the image but could not find documentation anywhere on how to download the profile image. If any of you have successfully implemented this, I could sure use some pointers. Thanks in advance!
↧