-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: User is not authorized to perform the desired action. #560
Comments
@shekharskamble how did you solve this? |
👍 1 |
@shekharskamble how did you manage to solve and close this issue? I am having the same issue and I bet others too ! A feedback would be real appreciative |
Extremely sorry for replying late, I don't exactly remember how did I solve this one but can you please try putting file in a folder like this .ref( you can set any file name you want. |
@shekharskamble This still doesn't work for me. Can this issue be re-opened? |
reopened... |
@perrosnk
|
@gcyagyu That opens the security rules to anyone. |
@gcyagyu this is not safe I want to enable each user to upload ONLY his profile photo. My rules look like this:
If I deactivate the last 2 lines:
it works. But I need this two lines for security reasons. Is anyone else facing this kind of problem? |
@perrosnk looks like you're running into a side effect of #739 with your security rules. We plan on addressing this as part of the 4.1.x release stream - we don't yet have a timescale I'm afraid, but in the meantime you may need to lower the security rules. I'm going to close this issue, as we now understand the reasoning. Track #739 for updates. |
@perrosnk have implemented a fix for mime/content types as part of the upcoming v4.3.0 release, mime types are automatically detected correctly now when uploading and can also be overridden using custom metadata. Should fix your rules issue. Thanks for reporting! |
We are facing the same issue and keep seeing this error : [storage/unauthorized] User is not authorized to perform the desired action. The user is authenticated and these are our storage rules: rules_version = '2'; |
I don't think that will have anything to do with react-native-firebase, i.e., it will not be a problem with this module. I think firebase storage has a rules simulator that can be used to try out different scenarios real time, maybe that would point out the problem in combo with the documentation. All I can suggest if you want to come at it from react-native-firebase's direction is to put console logs with arguments and results of each API call logged out before it goes down to the firebase-android-sdk and firebase-ios-sdk layers in Java and Objective-C to see exactly what is going in and coming out when things aren't behaving the way you want. That's usually how I find my project-specific coding errors when working with firebase. Hope this helps |
@minuhariharan Could it be related to this? #4690 |
i try the simulation of my rules and perfectly fine, it matches my database structure but when i store image with my react native app to my different storage bucket it shows an error , is says error always ::: " ERROR [Error: [storage/unauthorized] User is not authorized to perform the desired action.]" |
Issue
I am trying to upload image files in the storage using following code
import RNfirebase from 'react-native-firebase';
RNfirebase.storage().ref('tablen_ame').putFile(uploadUri).then(uploadedFile => {
//setting some state
})
.catch(err => {
console.log(err);
});
getting the error as "User is not authorized to perform the desired action."
Following is the storage rules in Firebase
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
I am also initializing FIrebase upon start of an app
import RNfirebase from 'react-native-firebase';
RNfirebase.initializeApp({...
AM I missing something or doing anything wrong?
Environment
The text was updated successfully, but these errors were encountered: