isAuthorizedSync

abstract fun isAuthorizedSync(resourceId: String, action: String): Boolean

Checks whether the logged-in member is authorized to perform action on resourceId using the locally cached RBAC policy. No network request is made; returns false if no policy is cached yet.

Kotlin:

val allowed = StytchB2B.rbac.isAuthorizedSync(
resourceId = "documents",
action = "read",
)

iOS:

let allowed = StytchB2B.rbac.isAuthorizedSync(resourceId: "documents", action: "read")

React Native:

const allowed = StytchB2B.rbac.isAuthorizedSync("documents", "read")

Return

true if the member is authorized; false otherwise or if no policy is cached.

Parameters

resourceId

The ID of the resource to check authorization for.

action

The action to check (e.g. "read", "write", "delete").