exchange_refresh_token: Exchange a refresh token for an ID token

View source: R/exchange_refresh_token.R

exchange_refresh_tokenR Documentation

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:

  • expires_in: The number of seconds in which the ID token expires.

  • token_type: The type of the refresh token, always "Bearer".

  • refresh_token: The Firebase Auth refresh token provided, or a new refresh token.

  • id_token: A Firebase Auth ID token.

  • user_id: The uid corresponding to the provided ID token.

  • project_id: Your Firebase project ID.

  • error:

    • NULL if no error code in response

    • A list of 2 if response was an error:

      • code: Error code

      • message: Error message

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)

firebase.auth.rest documentation built on April 3, 2025, 6:19 p.m.