FirebaseStorage is Exception

21 views
Skip to first unread message

kenji

unread,
Jun 4, 2017, 2:49:09 PM6/4/17
to Firebase Google Group
UnityEditor Playing
Firebase.Storage.StorageException: User does not have permission to access this object. ---> System.IO.IOException: The server has terminated the upload session

auth is SignInAnonymouslyAsync
set is editorserviceaccount
database is success

SetEditorDatabaseUrl
SetEditorP12FileName( "TestFi
SetEditorServiceAccountEmail(
SetEditorP12Password( "notase
SetEditorAuthUserId( "UnityEd

code:
var user = _auth.CurrentUser;
if( user == null )
return;
var imageRef = _storageReference.Child( "images/" + user.GetUserId() + ".png" );

var texture = new Texture2D( 64, 64, TextureFormat.ARGB32, false );
var colors = new Color32[ 64 * 64 ];
for( int y = 0; y < 64; y++ )
for( int x = 0; x < 64; x++ )
colors[ ( y * 64 ) + x ] = new Color32( (byte)UnityRandom.Range( 0, 256 ), (byte)UnityRandom.Range( 0, 256 ), (byte)UnityRandom.Range( 0, 256 ), 255 );

texture.SetPixels32( colors );
var pngBytes = texture.EncodeToPNG();

Debug.Log( "PutBytesAsync" );
imageRef.PutBytesAsync( pngBytes ).ContinueWith( task =>
{
if ( task.IsFaulted == true || task.IsCanceled == true )
{
Debug.Log( task.Exception.ToString() );
}
else
{
StorageMetadata metadata = task.Result;
var downloadUrl = metadata.DownloadUrl;
Debug.Log("downloadUrl = " + downloadUrl );
}
});




Reply all
Reply to author
Forward
0 new messages