Get current user (AppGyver Auth)

Get the current user info from the on-device storage when using an AppGyver Hosted/Cloud Auth backend.

Gets the current user info from the session in on-device storage where it is stored after a successful login.

In most cases, you should store the current user info to an app variable after successfully calling the Authenticate user or Validate session flow function.

If the current user was found from the on-device storage, the first output is triggered.

If the current user was not found, the second output is triggered.

To use this flow, your app must have its authentication type set as AppGyver Hosted Auth or AppGyver Cloud Auth.

Input arguments

No input arguments.

Output arguments

Number of outputs: 2

Label

Key

Type

Description

Current user

currentUser

Object

Object containing the current user information after the session was validated.

  • ID

currentUser.id

Number

Unique user ID for the logged-in user.

  • Username

currentUser.username

String

Username for the logged-in user, typically an email address

  • Metadata

currentUser.metadata

Object

User metadata. Since no schema is enforced by the backend, it is given here as a schemaless object.

  • Groups

currentUser.groups

Array

Groups the user belongs to.

  • Access token

currentUser.accessToken

String

Access token used to access AppGyver-hosted cloud resources, such as databases or integrations.

Events

No events.

Errors

Label

Code

Description

Current user not found

currentUserNotFound

Thrown if the device did not have a session for the current user stored in the on-device storage.