3

I am trying to upload files using firebase. The code works fine on devices with only internal storage but while trying on devices with external storage(SD card) it shows User does not have permission to access this object. Code: -13021 HttpResult: 403 error.

My manifest file contains following permissions

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Bhupesh Shrestha
  • 248
  • 3
  • 17
  • Your Android OS Version is 6.0 if yes then you have get runtime permission Look here http://stackoverflow.com/questions/38141523/directory-creation-not-working-in-marshmallow-android/38141778#38141778 – Sohail Zahid Jul 11 '16 at 12:48
  • Can we see some code which you are trying? – pRaNaY Jul 11 '16 at 12:59

5 Answers5

2

The default security rules for storage buckets require you to sign in with firebase authentication. You can use any authentication method. At a minimum, you must you anonymous signin by:

You can also set your rules to allow access to anyone -- including those who have not yet authenticated. But this is not recommended as your data will not be secure.

You will just need to use request.auth in your rules instead of just auth.

See StorageException: StorageException has occurred. User does not have permission to access this object.

Also Secure User Data to get more idea.

I hope its helps you.

pRaNaY
  • 24,642
  • 24
  • 96
  • 146
1

Check if target SDK version in build.gradle is 23, if so you need to implement runtime permissions or change it to 22

Eliahu Horwitz
  • 499
  • 3
  • 17
1

Do not build your project with targetSdk set to anything higher than 22 if your project requires additional permissions, because you must then support Runtime Permissions. As a quick solution, change targetSdk to 22, clean and rebuild your project and you will be fine.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

1.Go to your firebase console

2.Go to your app

3.Click on the authentication button in the left hand side

4.Click on the sign-in method tab

5.Hover on the anonymous item below in the list

6.Click on the pencil button at the right side of the item

7.Click on enable and then save

This should work

knightcube
  • 139
  • 1
  • 13
0

just go to the authentication and allow sign in method for anonymous and your problem will completely finish