Skip to content

Creates fresh state, nonce and PKCE code_verifier values (32 bytes from OpenSSL's random source each) and the authorization URL.

Usage

sso_start(client, prompt = NULL)

Arguments

client

A client from sso_client().

prompt

Optional. "none" asks the portal not to show any page: a person already signed in to the portal comes straight back with a code, and anyone else comes back with error=login_required (which sso_finish() reports as a rusckersso_provider_error). Use it to check quietly whether the portal session is still open, for instance when the app's own session expires. The default (NULL) sends no prompt at all.

Value

A list with url and pending (a list of state, nonce and code_verifier).

Details

Send the person's browser to url. Keep pending on the server (or in a short-lived HttpOnly cookie) until they come back; it is one plain list, so it can be saved however the app likes. Use it once.

Examples

if (FALSE) { # \dontrun{
# Needs a reachable portal: the first call reads its discovery document.
client <- sso_client(
  issuer = "https://portal.example.org",
  client_id = "my-app",
  client_secret = Sys.getenv("MY_APP_CLIENT_SECRET"),
  redirect_uri = "https://app.example.org/"
)
start <- sso_start(client)
start$url      # send the browser here
start$pending  # keep until the person comes back

# A quiet check: no page is shown to the person.
quiet <- sso_start(client, prompt = "none")
} # }