The auth
submodule allows you to work with Wix authentication and permissions.
This submodule is not intended for use with self-hosted Apps.
elevate()
Receives an SDK function and returns an instance of the same function that runs with the authentication and permissions of the current app.
Use elevate()
in frontend environments such as site or dashboard extensions when you need to make a call with Wix app authentication.
Learn more about elevated permissions.
Name | Type | Description |
---|---|---|
sourceFunction | function | SDK function to elevate. |
An SDK function that runs with app-level permissions.
Create a new product with elevated permissions:
getTokenInfo()
Returns the information encoded in the currently active token in backend extensions.
When developing backend extensions for an app or web methods, you might need to access information about the session making the request to your backend.
This information is encoded in the token sent with the request, and can be accessed using getTokenInfo()
. It can include the user ID, the site ID, the instance ID, and more.
A promise that resolves to the token info.
Code for extracting information from a request to a backend extension in a Wix CLI project:
Code for extracting information from a request to a web method: