replace()

Learn: Access providers

We recommend you use FSL to create and update access providers. See Access provider schema.

Replace an access provider.

Signature

replace(object: {*: Any}): { *: Any }

Description

The replace() method replaces a provider with the supplied object. This method removes any fields on the existing AccessProvider that are not supplied by the object, with some exceptions. The audience field which is read-only, and the immutable metadata fields coll and ts are not removed and can’t be replaced.

The object must include the required fields.

Parameters

Parameter Type Required Description

data

Object

Object describing the access provider.

data fields

Name Type Required Description

name

String

Yes

Unique access provider name.

issuer

String

Unique IdP HTTPS URL that you are using to grant access to Fauna. This is typically an account or application URL supplied by your IdP. Use an exact copy of your IdP issuer URL, including a trailing slash if it exists.

jwks_uri

String

Valid HTTPS URI, which serves the JSON Web Key (JWK) that signs the JSON Web Tokens (JWT) from your IdP.

Return value

Type Description

Object

A provider document with replaced fields.

Examples

AccessProvider.byName("anAccessProvider")!.replace({
  name: "justFineAccessProvider",
  issuer: "https://fauna.auth0.com",
  roles: "admin",
  jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json"
})
{
  name: "justFineAccessProvider",
  coll: AccessProvider,
  ts: Time("2023-07-28T03:50:44.400Z"),
  issuer: "https://fauna.auth0.com",
  roles: "admin",
  audience: "https://db.fauna.com/db/ywtfhw4poyynr",
  jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json"
}

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!