askpass: Password Prompt Utility

View source: R/askpass.R

askpassR Documentation

Password Prompt Utility


Prompt the user for a password to authenticate or read a protected key. By default, this function automatically uses the most appropriate method based on the user platform and front-end. Users or IDEs can override this and set a custom password entry function via the askpass option.


askpass(prompt = "Please enter your password: ")



the string printed when prompting the user for input.


By default askpass() returns NULL in non-interactive sessions. (These include knitr runs and testthat tests.) If you want to force a password prompt in non-interactive sessions, set the rlib_interactive option to TRUE:

options(rlib_interactive = TRUE)


# Prompt user for passwd
pw <- askpass("Please enter your password")

askpass documentation built on Sept. 4, 2023, 1:06 a.m.

Related to askpass in askpass...