Skip to content

Latest commit

 

History

History
211 lines (118 loc) · 3.72 KB

firebase_app.md

File metadata and controls

211 lines (118 loc) · 3.72 KB

FirebaseApp

Description

The Firebase App class that handles the authentication/authorization task.

class FirebaseApp

Functions

  1. 🔹 bool isInitialized() const

Get the app initialization status.

bool isInitialized() const

Returns:

  • bool - Return true if initialized.
  1. 🔹 void loop()

The authentication/authorization handler.

void loop()
  1. 🔹 bool ready()

Get the authentication/autorization process status.

bool ready()

Returns:

  • bool - Return true if the auth process was finished. Returns false if isExpired() returns true.
  1. 🔹 void getApp(T &app)

Appy the authentication/authorization credentials to the Firebase services app.

void getApp(T &app)

Params:

  • app - The Firebase services calss object e.g. RealtimeDatabase, Storage, Messaging, CloudStorage and CloudFunctions.
  1. 🔹 String getToken() const

Get the auth token.

String getToken() const

Returns:

  • String - String of auth tokens based on the authentication/authoeization e.g. ID token and access token.
  1. 🔹 String getRefreshToken() const

Get the refresh token.

String getRefreshToken() const

Returns:

  • String - String of refresh token after user sign in or authorization using ID token.
  1. 🔹 String getUid() const

Get unique identifier.

String getUid() const

Returns:

  • String - String of unique identifier after user sign in or authorization using ID token.
  1. 🔹 bool isAuthenticated() const

Get the authentication status since app initialized.

bool isAuthenticated() const

Returns:

  • bool - Return true once authenticated since initialized. It will reset when app re-initialized and user management task was executed.
  1. 🔹 bool isExpired()

Get the auth token expiration status.

bool isExpired()

Returns:

  • bool - Return true if auth token was expired upon the expire period setup.
  1. 🔹 unsigned long ttl()

Get the remaining time to live of token until expired.

unsigned long ttl()

Params:

  • unsigned long - The integer value of ttl.
  1. 🔹 void setCallback(AsyncResultCallback cb)

Set the async result callback function.

void setCallback(AsyncResultCallback cb)

Params:

  • cb - The async result callback function (AsyncResultCallback).
  1. 🔹 void setAsyncResult(AsyncResult &aResult)

Set the async result class object.

void setAsyncResult(AsyncResult &aResult)

Params:

  • aResult - The async result (AsyncResult).
  1. 🔹 void setUID(const String &uid)

Set the UID for authentication task.

The UID will be applied when used with the async result callback only.

The async result object set via initializeApp and FirebaseApp::setAsyncResult will not take effect.

void setUID(const String &uid)

Params:

  • uid - The unique identifier for the authentication task.
  1. 🔹 void setJWTProcessor(JWTClass &jwtClass)

Set the JWT token processor object.

This function should be executed before calling initializeApp.

void setJWTProcessor(JWTClass &jwtClass)

Params:

  • jwtClass - The JWT token processor object.
  1. 🔹 auth_data_t *getAuth()

Get the pointer to the internal auth data.

auth_data_t *getAuth()

Returns:

  • auth_data_t* - The pointer to internal auth data.
  1. 🔹 void deinitializeApp()

Reset or clear app (deinitailize).

void deinitializeApp()