[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

image

image

3. Docs

Events

UploadFailed Event raised when uploading fails
file | text
errorMsg | text
UploadProgress Event raised when upload progress changes
file | text
bytesTransferred | number
totalBytes | number
FileUploaded Event raised after file has been uploaded
file | 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 downloaded
fileName | text
outputPath | text
DownloadFailed Event indicating file downloading has failed
fileName | text
errorMsg | text
GotFilesList Event raised after getting files list
list | 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 info
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
GotIdToken Event raised after getting Id Token of current user
token | text
SignUpSuccessful Event raised if sign up was successful
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
SignUpFailed Event raised if sign up failed
errorMsg | text
LoginSuccessful Event raised if login was successful and provides user info
provider | text
userId | text
name | text
email | text
profilePicture | text
phoneNumber | text
LoginFailed Event raised when login failed
provider | text
errorMsg | text
UserUpdateFailed Event raised when some error occurred while updating user
type | text
errorMsg | text
UserUpdateSuccess Event raised when user info was successfully updated
type | text
UserDeletedResult Event raised after getting DeleteUser result
successful | boolean
OtpSent Event raised when OTP has been sent

Methods

Init Initializes firebase storage with provided credentials
projectId | text
apiKey | text
storageBucket | text
appId | text
oauthKey | text
Upload Uploads file from given path/uri
filePath | text
fileName | text
BucketName Returns storage bucket name
GetMetadata Tries to get metadata of file
fileName | 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 file
fileName | text
PauseDownloads Pause all active downloads
ResumeDownloads Resume all download tasks
PauseUploads Pause all upload tasks
SignUpWithEmail Sign up with email and password
email | 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 password
email | text
password | text
LoginWithGoogle Login the user with Google
SignOut Sign out the currently signed user
UpdateEmail Update the email address of current user
email | text
UpdateProfile Update display name and profile picture of current user
displayName | text
photoUrl | text
VerifyEmail Send email for verification
SendPasswordResetEmail Sends password reset email
UpdatePassword Updates the password of currently signed user
newPassword | text
DeleteUser Deletes currently signed user
SignInWithPhone Sign in user with Phone Number
phoneNumber | text
VerifyPhoneNumber Verify OTP to sign in with Phone Number
otp | text

Properties

4. Usages

Init
image

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

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!

20 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
Screenshot 2023-09-09 160518

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.

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:

https://sunnythedeveloper.in/free-fsa-combined-features-of-firebase-storage-and-authentication-🔥

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.