Core
Framework v2.x
2

as #

Returns a new EmbeddedSDK instance impersonating the provided user.

Arguments #

Copied to clipboard!
as (user: { _id: string }, options = { checkRights: false }): EmbeddedSDK;

Argument Type Description
user
{ _id: string }
User object with at least the _id property
options
object
Optional object with at least the checkRights property

options:

Available since 2.10.0
Property Type (default) Description
checkRights
boolean
If true, will check if the impersonated user is allowed to execute any following actions

Returns #

Returns a new impersonated EmbeddedSDK instance.

Usage #

Copied to clipboard!
await app.sdk.as(request.context.user).auth.getCurrentUser();