Title: R Wrapper for 'Firebase Authentication REST API'
Version: 1.0.1
Description: A convenient and user-friendly interface to interact with the 'Firebase Authentication REST API': https://firebase.google.com/docs/reference/rest/auth. It enables R developers to integrate 'Firebase Authentication' services seamlessly into their projects, allowing for user authentication, account management, and other authentication-related tasks.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
URL: https://github.com/kennedymwavu/firebase.auth.rest
BugReports: https://github.com/kennedymwavu/firebase.auth.rest/issues
Imports: httr2 (≥ 0.2.3)
NeedsCompilation: no
Packaged: 2025-07-18 00:26:55 UTC; mwavu
Author: Kennedy Mwavu ORCID iD [aut, cre, cph] (Maintainer/developer of firebase.auth.rest since 2024)
Maintainer: Kennedy Mwavu <mwavukennedy@gmail.com>
Repository: CRAN
Date/Publication: 2025-07-18 02:20:02 UTC

Change email

Description

Change email

Usage

change_email(id_token, email)

Arguments

id_token

String. A Firebase Auth ID token for the user.

email

String. User's new email.

Details

DISCLAIMER: Changing a users's email requires that you disable email enumeration protection for your firebase project. This is NOT recommended.

Value

A named list with the following items:

Examples

## Not run: 
  # first sign in user and get the 'id_token':
  user <- sign_in(email = "user@gmail.com", password = "password")
  id_token <- user$idToken

  # change email:
  response <- change_email(
    id_token = id_token,
    email = "new.email@mail.com"
  )
  response

## End(Not run)

Change password

Description

Change password

Usage

change_password(id_token, password)

Arguments

id_token

A Firebase Auth ID token for the user.

password

User's new password.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  # first sign in user and get the 'id_token':
  user <- sign_in(email = "user@gmail.com", password = "password")
  id_token <- user$idToken

  # change password:
  response <- change_password(
    id_token = id_token,
    password = "new-user-password"
  )
  response

## End(Not run)

Delete account

Description

Delete account

Usage

delete_account(id_token)

Arguments

id_token

The Firebase ID token of the user to delete.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  # first sign in user and get the 'id_token':
  user <- sign_in(email = "user@gmail.com", password = "password")
  id_token <- user$idToken

  # delete user account:
  response <- delete_account(id_token = id_token)
  response

## End(Not run)

Exchange custom token for an ID and refresh token

Description

Exchanges a custom Auth token for an ID and refresh token

Usage

exchange_custom_token(token)

Arguments

token

String. A Firebase Auth custom token from which to create an ID and refresh token pair

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  exchange_custom_token(token = "your-firebase-auth-custom-token")

## End(Not run)

Exchange a refresh token for an ID token

Description

Refreshes a Firebase ID token

Usage

exchange_refresh_token(refresh_token)

Arguments

refresh_token

String. A Firebase Auth refresh token.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  # first sign in user and get the 'refresh_token':
  user <- sign_in(email = "user@gmail.com", password = "password")
  refresh_token <- user$refreshToken

  # exchange the refresh token:
  response <- exchange_refresh_token(refresh_token = refresh_token)
  response

## End(Not run)

Get user data from firebase

Description

Get user data from firebase

Usage

get_user_data(id_token)

Arguments

id_token

String. The Firebase ID token of the account.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  user_data <- get_user_data("<id_token>")
  lapply(user_data, `[[`, 1)

## End(Not run)

Send email verification

Description

Send email verification

Usage

send_email_verification(id_token)

Arguments

id_token

The Firebase ID token of the user to verify.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  send_email_verification("id-token-goes-here")

## End(Not run)

Send password reset email

Description

Send password reset email

Usage

send_password_reset_email(email)

Arguments

email

User's email address.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  send_password_reset_email("user-email-goes-here")

## End(Not run)

Sign in a user with email & password

Description

Sign in a user with email & password

Usage

sign_in(email, password)

Arguments

email

User email

password

User password

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  sign_in(email = "user-email", password = "strong-password")

## End(Not run)

Sign in a user anonymously

Description

Sign in a user anonymously

Usage

sign_in_anonymously()

Details

To use sign in users anonymously, you must first enable the Anonymous sign in method in your firebase project.

Go to Firebase console and check your Sign-in providers under the Sign-in Methods tab in the Authentication service and make sure Anonymous is enabled.

Visit Firebase Auth REST API docs for more details.

Value

A named list with the following items:

Examples

## Not run: 
  user <- sign_in_anonymously()
  user

## End(Not run)

Sign up with email/password

Description

Sign up with email/password

Usage

sign_up(email, password)

Arguments

email

The email for the user to create.

password

The password for the user to create.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  sign_up(email = "new-user-email", password = "strong-password")

## End(Not run)

Update user profile

Description

Update a user's profile (display name / photo URL).

Usage

update_profile(
  id_token,
  display_name = NULL,
  photo_url = NULL,
  delete_attribute = NULL
)

Arguments

id_token

String. A Firebase Auth ID token for the user.

display_name

String. User's new display name. Defaults to NULL.

photo_url

String. User's new photo url. Defaults to NULL.

delete_attribute

Character vector of attributes to delete. Either "DISPLAY_NAME" or "PHOTO_URL". This will nullify these values. Defaults to NULL.

Details

Visit Firebase Auth REST API docs for more details

Value

A named list with the following items:

Examples

## Not run: 
  update_profile(
    id_token = "id-token-goes-here",
    display_name = "new-user-display-name",
    photo_url = "url-to-user-photo"
  )

  # to delete the display name attribute:
  update_profile(
    delete_attribute = "DISPLAY_NAME"
  )

## End(Not run)