Package 'cognitoR'

Title: Authentication for 'Shiny' Apps with 'Amazon Cognito'
Description: Provides authentication for Shiny applications using 'Amazon Cognito' ( <https://aws.amazon.com/es/cognito/>).
Authors: Pablo Pagnone [aut, cre], Aleksander Dietrichson [aut]
Maintainer: Pablo Pagnone <[email protected]>
License: GPL-3
Version: 1.0.4
Built: 2025-02-22 03:40:03 UTC
Source: https://github.com/chi2labs/cognitor

Help Index


Allow create an user in Cognito Pool

Description

This method is working with amazing package "paws" , so you need to have the required AWS secret and access key (see example).

Usage

cognito_add_account(
  cognito_config,
  Username,
  UserAttributes,
  DesiredDeliveryMediums,
  ...
)

Arguments

cognito_config

- Cognito Config list

Username

- Username to use in Cognito - This can be a username, email ,phone depending configuration in Amazon Pool.

UserAttributes

- User attributes: This can be multiples attributes, depends of configuration in Amazon Pool.

DesiredDeliveryMediums

- Medium to delivert email when user is created, can be EMAIL or SMS

...

extra params to pass to method paws::admin_create_user

Details

Also needs to have the config for cognitoR. Specially the pool Id (group_id in config), where the new user is created.

Value

boolean

Examples

## Not run: 
Sys.setenv(
AWS_ACCESS_KEY_ID = '',
AWS_SECRET_ACCESS_KEY = '',
AWS_REGION = ''
)
cognito_add_account("[email protected]",
                    UserAttributes = list(list(Name = "email", Value = "[email protected]"),
                                          list(Name = "phone_number", Value = "+12123212312321")
                                     ),
                    DesiredDeliveryMediums = "EMAIL"
                    )

## End(Not run)

Cognito Shiny Module Server

Description

A shiny server function to implement Cognito Authentication in your shiny app.

Usage

cognito_server(
  input,
  output,
  session,
  with_cookie = FALSE,
  cookiename = "cognitor",
  cookie_expire = 7
)

Arguments

input

- Shiny input

output

- Shiny Output

session

- Shiny Session

with_cookie

- Create a own cookie when is authenticated in Cognito.

cookiename

- name for cookie

cookie_expire

- Expiration time for cookie

Value

reactiveValues (isLogged and userdata) and a callback function to do logout in Cognito.

Author(s)

Pablo Pagnone


Cognito Shiny Module UI

Description

A Shiny UI function to be used to implement Amazon Cognito in your shiny app. This UI loads the required JS.

Usage

cognito_ui(id)

Arguments

id

character - Namespace ID

Value

A Shiny UI

Author(s)

Pablo Pagnone

Examples

cognito_ui("demo")

Logout Shiny Module Server

Description

Receive a reactive element (isLogged), when is TRUE the logout button and information about is shown.

Usage

logout_server(
  input,
  output,
  session,
  isLogged = reactive(FALSE),
  textlogged = "You are logged in"
)

Arguments

input

Shiny input

output

Shiny output

session

Shiny session

isLogged

reactive

textlogged

character

Value

reactive (the logout button)

Examples

logout_server(NULL, NULL, NULL)

Logout Shiny Module UI

Description

Return a UI with a logout button and information about user logged. By default is hidden and is show with reactive element from logoutServer

Usage

logout_ui(id, textbutton = "Log out", classbutton = "btn-logout btn-danger")

Arguments

id

character

textbutton

character

classbutton

character

Value

Shiny UI

Examples

logout_ui("test")