title | sidebar_position | slug | description |
---|---|---|---|
Perform a Check |
4 |
/getting-started/perform-check |
Checking if a user is authorized to perform an action on a resource |
import { SupportedLanguage, languageLabelMap, CheckRequestViewer, DocumentationNotice, ProductConcept, ProductName, ProductNameFormat, RelatedSection, SdkSetupHeader, SdkSetupPrerequisite, } from '@components/Docs'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This section will illustrate how to perform a request to determine whether a has a certain with an .
- You have installed the SDK.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have installed the SDK.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
- You have configured the authorization model.
- You have loaded
FGA_STORE_ID
andFGA_SERVER_URL
as environment variables.
- You have configured the authorization model and updated the relationship tuples.
- You have loaded
FGA_STORE_ID
andFGA_API_HOST
as environment variables.
Assume that you want to check whether user anne
has relationship reader
with object document:Z
Before calling the check API, you will need to configure the API client.
To obtain the access token:
To check whether user user:anne
has relationship reader
with object document:Z
<CheckRequestViewer user={'user:anne'} relation={'reader'} object={'document:Z'} allowed={true} skipSetup={true} allowedLanguages={[ SupportedLanguage.JS_SDK, SupportedLanguage.GO_SDK, SupportedLanguage.DOTNET_SDK, SupportedLanguage.PYTHON_SDK, SupportedLanguage.JAVA_SDK, SupportedLanguage.CLI, SupportedLanguage.CURL, ]} />
The result's allowed
field will return true
if the relationship exists and false
if the relationship does not exist.
<RelatedSection description="Take a look at the following section for more on how to perform authorization checks in your system" relatedLinks={[ { title: '{ProductName} Check API', description: 'Read the Check API documentation and see how it works.', link: '/api/service#Relationship%20Queries/Check', }, ]} />