Learn R Programming

polished (version 0.4.0)

Sessions: R6 class to track polished sessions

Description

An instance of this class handles the 'polished' user sessions for each 'shiny' app using 'polished'. The 'shiny' developer should not need to interact with this class directly.

Arguments

Methods

Public methods

Method config()

polished Sessions configuration function

Usage

Sessions$config(
  firebase_config = NULL,
  admin_mode = FALSE,
  is_invite_required = TRUE,
  sign_in_providers = "email",
  is_email_verification_required = TRUE,
  is_auth_required = TRUE
)

Details

This function is called via global_sessions_config() in global.R of all Shiny apps using polished.

Method sign_in_social()

verify the users Firebase JWT and store the session

Usage

Sessions$sign_in_social(firebase_token, hashed_cookie)

Arguments

firebase_token

the Firebase JWT. This JWT is created client side (in JavaScript) via firebase.auth().

hashed_cookie

the hashed polished cookie. Used for tracking the user session. This cookie is inserted into the "polished.sessions" table if the JWT is valid.

Returns

NULL if sign in fails. If sign in is successful, a list containing the following:

  • email

  • email_verified

  • is_admin

  • user_uid

  • hashed_cookie

  • session_uid

Method get_invite_by_email()

Usage

Sessions$get_invite_by_email(email)

Method find()

Usage

Sessions$find(hashed_cookie, page)

Method sign_in_email()

Usage

Sessions$sign_in_email(email, password, hashed_cookie)

Method register_email()

Usage

Sessions$register_email(email, password, hashed_cookie)

Method refresh_email_verification()

Usage

Sessions$refresh_email_verification(session_uid, firebase_token)

Method set_signed_in_as()

Usage

Sessions$set_signed_in_as(session_uid, signed_in_as, user_uid = NULL)

Method get_signed_in_as_user()

Usage

Sessions$get_signed_in_as_user(user_uid)

Method set_inactive()

Usage

Sessions$set_inactive(session_uid, user_uid)

Method sign_out()

Usage

Sessions$sign_out(hashed_cookie)

Method get_admin_mode()

Usage

Sessions$get_admin_mode()

Method clone()

The objects of this class are cloneable with this method.

Usage

Sessions$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.