1. Introduction
Description: This extension uses latest Firebase Storage SDK [20.2.1] and Firebase Auth SDK [22.2.0] to integrate its features in your app. You can easily do these operations:
- upload file
- download file
- list files
- delete file
- get metadata of files
…. and all basic authentication features which includes
- Sign up with email & password
- Login with email & password
- Login with Google
- Login with Microsoft
- Sign In with Phone Number
- Get User info
- Update User info (Profile, Email, Password)
- Verify Email address with link
- Send password reset link on email
- Get Id Token
- Delete user
Latest Version:Β 3.2
Released:Β Β September 8, 2023
Last Updated:Β Β August 4, 2024
2. Blocks
3. Docs
UploadFailed | Event raised when uploading failsfile | text errorMsg | text |
UploadProgress | Event raised when upload progress changesfile | text bytesTransferred | number totalBytes | number |
FileUploaded | Event raised after file has been uploadedfile | text fileName | text downloadUrl | text |
GotMetadata | Event raised after getting metadata. If any error occurred then dictionary will have single key named ‘errorMsg’.metadataDict | dictionary |
DownloadSuccessful | Event indicating file has been downloadedfileName | text outputPath | text |
DownloadFailed | Event indicating file downloading has failedfileName | text errorMsg | text |
GotFilesList | Event raised after getting files listlist | list |
FileDeleted | Event raised after getting delete response. If successful then response will be empty, otherwise error msg.successful | boolean response | text |
GetUserInfoFailed | Event raised if some error occurred while getting user info |
GotUserInfo | Event raised after getting user infoprovider | text userId | text name | text email | text profilePicture | text phoneNumber | text |
GotIdToken | Event raised after getting Id Token of current usertoken | text |
SignUpSuccessful | Event raised if sign up was successfulprovider | text userId | text name | text email | text profilePicture | text phoneNumber | text |
SignUpFailed | Event raised if sign up failederrorMsg | text |
LoginSuccessful | Event raised if login was successful and provides user infoprovider | text userId | text name | text email | text profilePicture | text phoneNumber | text |
LoginFailed | Event raised when login failedprovider | text errorMsg | text |
UserUpdateFailed | Event raised when some error occurred while updating usertype | text errorMsg | text |
UserUpdateSuccess | Event raised when user info was successfully updatedtype | text |
UserDeletedResult | Event raised after getting DeleteUser resultsuccessful | boolean |
OtpSent | Event raised when OTP has been sent |
Init | Initializes firebase storage with provided credentialsprojectId | text apiKey | text storageBucket | text appId | text oauthKey | text |
Upload | Uploads file from given path/urifilePath | text fileName | text |
BucketName | Returns storage bucket name |
GetMetadata | Tries to get metadata of filefileName | text |
Download | Tries to download specified file to output path/uri. If providing Uri as output then make sure to create the file first with SAF. If path provided then file will be created if it doesn’t exixt.fileName | text outputPath | text |
ListFiles | Gets a list of files in specified folder. For root folder provide ‘/’ as argument.folder | text |
Delete | Delets specified filefileName | text |
PauseDownloads | Pause all active downloads |
ResumeDownloads | Resume all download tasks |
PauseUploads | Pause all upload tasks |
SignUpWithEmail | Sign up with email and passwordemail | text password | text |
IsSignedIn | Return whether there is an active user or not |
GetUserInfo | Tries to get user info of currently signed user |
GetIdToken | Tries to get id token |
LoginWithEmail | Login user with email and passwordemail | text password | text |
LoginWithGoogle | Login the user with Google |
SignOut | Sign out the currently signed user |
UpdateEmail | Update the email address of current useremail | text |
UpdateProfile | Update display name and profile picture of current userdisplayName | text photoUrl | text |
VerifyEmail | Send email for verification |
SendPasswordResetEmail | Sends password reset email |
UpdatePassword | Updates the password of currently signed usernewPassword | text |
DeleteUser | Deletes currently signed user |
SignInWithPhone | Sign in user with Phone NumberphoneNumber | text |
SignInWithMicrosoft | Sign In user with Microsoft Azure Active DirectorycustomParameters | dictionary scopes | list |
VerifyPhoneNumber | Verify OTP to sign in with Phone Numberotp | text |
4. Usages
Init
You can easily find these credentials in google-services.json
file which you get after adding your app to Firebase project and adding Auth + Storage features.
Upload
Image will be uploaded in test
subfolder. Use /
as prefix (eg. /sample.jpg
) to upload files into root folder.
List Files, Get Metadata and Download
metadata dictionary keys
- downloadUrl
- contentDisposition
- contentEncoding
- contentType
- timeCreated
- updated
- size
Values may contain \
, make sure to remove it
Authentication blocks are self explanatory. So I’ll add blocks for that later, if needed.
5. Downloads
Licensed under creativecommons.org/licenses/by-sa/4.0
An attribution and link to sunnythedeveloper.in is must
6. Support Me
Your support will really motivate me to create more such extensions.
Thank you.
Hope it helps!
Can it working on Android builder
Not tried but it should work if don’t add Firebase Auth component.
Tell me where to find “oauthkey” for initialization? I seem to have looked through everything, but I still havenβt found it.
See here.
https://community.appinventor.mit.edu/t/free-fsa-combined-features-of-firebase-storage-and-authentication/92515/29
It is client_id with type = 3.
Hi Sunny, how can i get the authKey for the Init. block?
You can find it in google-services.json file. It is client id with type = 3.
SignOut method crashes apps (tested in Niotron and Mit App)
Yes, I am working on it.
Could you post the correct blocks and steps for the auth phone number, please!
You can check aia for blocks.
Firebase Storage component is not present.
i am not able to use it
Check which version of extension are you using.
Also mention what other Firebase related components/extensions you are using.
I’m trying to download several “.pdf” files from Storage Firebase, but when I put this path “/storage/emulated/0/Download/PartiturasSAX/” in “Outputpath” the files are downloaded, overlapping each other, and finally, Only the last file remains in the “/storage/emulated/0/Download/” folder, but with the name “PartiturasSAX” and without the “.pdf”.
And in fact, it was supposed to create the folder “PartiturasSAX” Inside “Download” and download all the files in it
Show blocks
Not accessible. Either directly upload image or share via drive.