[FREE] FSA: Combined features of Firebase Storage and Authentication 🔥

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
  • 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.1
Released: 2023-09-07T18:30:00Z
Last Updated: 2023-11-08T18:30:00Z

2. Blocks

3. Docs

Events

UploadFailedEvent raised when uploading fails
file | text
errorMsg | text
UploadProgressEvent raised when upload progress changes
file | text
bytesTransferred | number
totalBytes | number
FileUploadedEvent raised after file has been uploaded
file | text
fileName | text
downloadUrl | text
GotMetadataEvent raised after getting metadata. If any error occurred then dictionary will have single key named 'errorMsg'.
metadataDict | dictionary
DownloadSuccessfulEvent indicating file has been downloaded
fileName | text
outputPath | text
DownloadFailedEvent indicating file downloading has failed
fileName | text
errorMsg | text
GotFilesListEvent raised after getting files list
list | list
FileDeletedEvent raised after getting delete response. If successful then response will be empty, otherwise error msg.
successful | boolean
response | text
GetUserInfoFailedEvent raised if some error occurred while getting user info
GotUserInfoEvent raised after getting user info
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
GotIdTokenEvent raised after getting Id Token of current user
token | text
SignUpSuccessfulEvent raised if sign up was successful
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
SignUpFailedEvent raised if sign up failed
errorMsg | text
LoginSuccessfulEvent raised if login was successful and provides user info
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
LoginFailedEvent raised when login failed
provider | text
errorMsg | text
UserUpdateFailedEvent raised when some error occurred while updating user
type | text
errorMsg | text
UserUpdateSuccessEvent raised when user info was successfully updated
type | text
UserDeletedResultEvent raised after getting DeleteUser result
successful | boolean
OtpSentEvent raised when OTP has been sent

Methods

InitInitializes firebase storage with provided credentials
projectId | text
apiKey | text
storageBucket | text
appId | text
oauthKey | text
UploadUploads file from given path/uri
filePath | text
fileName | text
BucketNameReturns storage bucket name
GetMetadataTries to get metadata of file
fileName | text
DownloadTries 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
ListFilesGets a list of files in specified folder. For root folder provide '/' as argument.
folder | text
DeleteDelets specified file
fileName | text
PauseDownloadsPause all active downloads
ResumeDownloadsResume all download tasks
PauseUploadsPause all upload tasks
SignUpWithEmailSign up with email and password
email | text
password | text
IsSignedInReturn whether there is an active user or not
GetUserInfoTries to get user info of currently signed user
GetIdTokenTries to get id token
LoginWithEmailLogin user with email and password
email | text
password | text
LoginWithGoogleLogin the user with Google
SignOutSign out the currently signed user
UpdateEmailUpdate the email address of current user
email | text
UpdateProfileUpdate display name and profile picture of current user
displayName | text
photoUrl | text
VerifyEmailSend email for verification
SendPasswordResetEmailSends password reset email
UpdatePasswordUpdates the password of currently signed user
newPassword | text
DeleteUserDeletes currently signed user
SignInWithPhoneSign in user with Phone Number
phoneNumber | text
VerifyPhoneNumberVerify OTP to sign in with Phone Number
otp | text

Properties

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

5. Download

v1 aix: com.sunny.fs.aix (~ 1.9 mb)

v3 and v3.1 aix can be downloaded from my site.

Thank you.
Hope it helps!

22 Likes

Thank you very much for another great extension!

This is going to be a popular extension. When Auth support is added, it should be a paid extension.

1 Like

Thanks.
But I am confused whether to integrate Firebase Authentication in this extension or keep that separate.
First one seems good from perspective of user as apk size won't be increased much.

I got this with the companion

Could help me, how to use this block

Extension doesn't work in Companion.
Please try in apk.

1 Like

OK Thanks @vknow360 I will try to do this ,
Thanks again for this awesome Extension !!

1 Like

Managing the manifest for different Firebase extensions can be a challenging task. As far as I remember, there are some registrars that need to be present in the manifest to make the respective Firebase service work. The GMS version meta tag may generate error while publishing if compiled into the app through both extensions.

It works fine, just compiled a project with Crashlytics + Storage extensions together.

I agree connecting two different services together will be challenging task and I might have to manipulate some firebase and gms classes. So I'll go with the easier option to combine both features and rename this extension.

1 Like

It may generate error while publishing, play store won't accept the APK if the GMS meta-tag is duplicated.

1 Like

If someone is using this extension in his/her project and would like to continue with the update then I'll suggest to create a backup immediately.
Update will be breaking a lot of things.

What I wish To Do:

  • Change extension name to FSA
    acronym for Firebase Storage and Authentication combined
  • Rename/Remove some events and methods
  • Add Firebase Authentication

Where can i find it?

@ason_J

Thank you

It does not work.
I don't know why.
:thinking:
Attached is my block:

@ason_J you missed it.

Sorry, I didn't look carefully

ChangeLog Version 2 :warning:

New Blocks

Changes

  • Changed extension name to FSA

  • image
    Init method no longer accepts parameters
    Upload google-services.json file to assets and configs will be picked up from there.

Download aix from here:

3 Likes

Will this file in resources be safe in the compiled apk? Or will keys written in code be more secure?

1 Like

It will be safe as much as assets are.