WixProvider

について WixProvider component provides functionality for working with the Wix JavaScript SDK in a React project using the @wix/sdk-react package.

注:

  • すべて @wix/sdk-react functionality must be wrapped inside a WixProvider component.
  • Don't explicitly create a WixProvider when using @wix/dashboard-react. The main withDashboard() function intializes a provider for you behind the scenes.

Props

名称タイプ説明
authAuthenticationStrategyThe authentication strategy to use for authenticating API calls, such as OAuthStrategy, AppStrategy, or APIKeyStrategy.
hostHostOptional. An API host. You only need to specify a host when using a client to access hosted modules, such as the dashboard module.

注: In most scenarios, the React SDK is used on client environments such as browsers and mobile apps, and so shouldn't be initialized with an authentication strategy with administrative permissions, like the ApiKeyStategy. To learn more, see Authorization Strategies.

The following examples show how to pass the WixProvider the relevant authentication information for Wix Headless, Wix apps, and Wix apps with a dashboard page.

Authenticate with OAuth for Wix Headless

コピー
1

Authenticate with OAuth for Wix apps

コピー
1

Authenticate with the dashboard strategy

について dashboard.auth() authentication strategy provides an access token for the currently logged-in user in the Wix Dashboard. This token allows your code to access APIs using the permissions of the logged-in user, limited to the permissions granted to your app.

について dashboard module is designed for use within the Wix platform environment, granting access to Wix Dashboard frontend APIs, like showToast. To use this module, initialize the WixProvider with the host object obtained from dashboard.host().

コピー
1
役に立ちましたか?
はい
いいえ