Skip to main content

Overview

useFetchUserByForeignId returns a function that fetches a user’s public profile using their foreignId — the ID from your own system that was associated with this user during authentication. Use this when you have your own user ID and need to look up the corresponding Sublay user profile.

Usage Example

Parameters

The hook returns a function. That function accepts:
foreignId
string
required
The foreign ID to look up. This is the identifier from your own system that was passed when the user was created or verified.
include
string | string[]
Optional. Pass "files" to populate avatarFile and bannerFile with full File objects.

Returns

User
User
The user’s public profile. When spaceReputation is requested, it carries an added spaceReputation number. See User data model and Reputation.