Skip to content

Latest commit

 

History

History
177 lines (124 loc) · 6.09 KB

perform-check.mdx

File metadata and controls

177 lines (124 loc) · 6.09 KB
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';

Perform a Check

This section will illustrate how to perform a request to determine whether a has a certain with an .

Before You Start

  1. You have installed the SDK.
  2. You have configured the authorization model and updated the relationship tuples.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model and updated the relationship tuples.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model and updated the relationship tuples.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model and updated the relationship tuples.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model and updated the relationship tuples.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have configured the authorization model.
  2. You have loaded FGA_STORE_ID and FGA_SERVER_URL as environment variables.
  1. You have configured the authorization model and updated the relationship tuples.
  2. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.

Step By Step

Assume that you want to check whether user anne has relationship reader with object document:Z

01. Configure the API Client

Before calling the check API, you will need to configure the API client.

To obtain the access token:

02. Calling Check API

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.

Related Sections

<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', }, ]} />