Skip to content

Convenience wrapper around gargle::token_fetch() that obtains a token suitable for authenticating with an autosync server.

Usage

amsync_auth(
  email = gargle::gargle_oauth_email(),
  scopes = "https://www.googleapis.com/auth/userinfo.email",
  ...
)

Arguments

email

Email address to use for authentication, or NULL for interactive selection. See gargle::gargle_oauth_email().

scopes

OAuth2 scopes. Defaults to userinfo.email which is sufficient for identity verification.

...

Additional arguments passed to gargle::token_fetch().

Value

Character string containing the access token.

Examples

if (FALSE) { # \dontrun{
# Interactive authentication
token <- amsync_auth()

# Use with amsync_fetch
doc <- amsync_fetch(
  url = "wss://secure-server.example.com",
  doc_id = "myDocId",
  access_token = token
)

# Specify email for non-interactive use
token <- amsync_auth(email = "user@example.com")
} # }