| guard_google | R Documentation |
This guard requests you to log in with google and authenticates you
through their service. Your server must be registered and have a valid client
ID and client secret for this to work. Read more about registering an
application at https://developers.google.com/identity/protocols/oauth2. If
you want to limit access to only select users you should make sure to provide
a validate function that checks the userinfo against a whitelist.
guard_google(
redirect_url,
client_id,
client_secret,
oauth_scopes = "profile",
service_params = list(access_type = "offline", include_granted_scopes = "true"),
...,
name = "google"
)
redirect_url |
The URL the authorization server should redirect to following a successful authorization. Must be equivalent to one provided when registering your application |
client_id |
The ID issued by the authorization server when registering your application |
client_secret |
The secret issued by the authorization server when registering your application. Do NOT store this in plain text |
oauth_scopes |
Optional character vector of scopes to request the
user to grant you during authorization. These will not influence the
scopes granted by the |
service_params |
A named list of additional query params to add to
the url when constructing the authorization url in the
|
... |
Arguments passed on to
|
name |
The name of the guard |
A GuardOIDC object
guard_google() automatically adds user information according to the
description in guard_oidc(). It sets the provider field to "google".
Documentation for Googles OpenID Connect flow
google <- guard_google(
redirect_url = "https://example.com/auth",
client_id = "MY_APP_ID",
client_secret = "SUCHASECRET"
)
# Add it to a fireproof plugin
fp <- Fireproof$new()
fp$add_guard(google, "google_auth")
# Use it in an endpoint
fp$add_auth("get", "/*", google_auth)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.