API reference

Users Class

Modifiers: final
This class provides methods to access information about the User. It allows you to retrieve a user's ID, access token, and org-scoped ID, as well as their friends list and recently met users. Additionally, it provides methods to launch various flows such as blocking, unblocking, reporting, and sending friend requests. It's useful when you need to manage user relationships or perform actions that require user authentication within your application.

Signature

class Users

Constructors

Users ()
Signature
constructor()
Returns
Users

Methods

get ( userId )
Retrieve the user with the given ID. This might fail if the ID is invalid or the user is blocked. NOTE: Users will have a unique ID per application.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun get(userId: String): User
Parameters
userId: String
Returns
User  The user with the given ID, or null if the ID is invalid or the user is blocked.
getAccessToken ()
Return an access token string for this user, suitable for making REST calls against graph.oculus.com.
This method can return the following status codes: common status codes in UsersStatusCode, UsersStatusCode.UserAccessTokenNotAvailable.
Signature
suspend fun getAccessToken(): String
Returns
String  The access token string.
getBlockedUsers ( coroutineScope )
Return the IDs of users entitled to use the current app that are blocked by the specified user
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
fun getBlockedUsers(coroutineScope: CoroutineScope): PagedResults<BlockedUser>
Parameters
coroutineScope: CoroutineScope
Returns
PagedResults  The list of blocked users that are entitled to use the current app.
getLinkedAccounts ( userOptions )
Returns a list of linked accounts that are associated with the specified service providers. Customization can be done via UserOptions. Create this object with UserOptions. The params that could be used are:
  1. horizon.platform.users.options.UsersOptions.serviceProvider.add - returns the list of linked accounts that are associated with these specified service providers. Example custom C++ usage:
// TODO: add kotlin code sample
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun getLinkedAccounts(userOptions: UserOptions): List<LinkedAccount>
Parameters
userOptions: UserOptions
Returns
List  The list of linked accounts that are associated with the specified service providers.
getLoggedInUser ()
Retrieve the currently signed in user. This call is available offline. NOTE: Please be aware that this function will only return the following information about the user: Alias (Oculus ID), ID (App Scoped ID), Profile URL (image_url). If you need to retrieve additional user information, such as presence details, please use the App Scoped ID obtained from Users.GetLoggedInUser() in conjunction with Users.Get(ulong UserID). This will provide access to more comprehensive user data. Retrieve the currently signed in user. This call is available offline. NOTE: This will not return the user's presence as it should always be 'online' in your application. NOTE: Users will have a unique ID per application.
This method can return the following status codes: common status codes in UsersStatusCode, UsersStatusCode.CursorNotFoundError, UsersStatusCode.JsonParseError.
Signature
suspend fun getLoggedInUser(): User
Returns
User  The currently signed in user.
getLoggedInUserFriends ( coroutineScope )
Retrieve a list of the logged in user's bidirectional followers. The payload type will be an array of User A list of the logged in user's bidirectional followers.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
fun getLoggedInUserFriends(coroutineScope: CoroutineScope): PagedResults<User>
Parameters
coroutineScope: CoroutineScope
Returns
PagedResults  The list of the logged in user's bidirectional followers.
getLoggedInUserManagedInfo ()
Retrieve the currently signed in user's managed info. This call is not available offline. NOTE: This will return data only if the logged in user is a managed Meta account (MMA).
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun getLoggedInUserManagedInfo(): User
Returns
User  The currently signed in user's managed info.
getOrgScopedId ( userId )
returns an ovrID which is unique per org. allows different apps within the same org to identify the user.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun getOrgScopedId(userId: String): OrgScopedID
Parameters
userId: String
Returns
OrgScopedID  The org scoped ID for the given user.
getSdkAccounts ()
Returns all accounts belonging to this user. Accounts are the Oculus user and x-users that are linked to this user.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun getSdkAccounts(): List<SdkAccount>
Returns
List  The list of accounts belonging to this user.
getUserProof ()
Part of the scheme to confirm the identity of a particular user in your backend. You can pass the result of Users.getUserProof and a user ID from User.id to your backend. Your server can then use our api to verify identity. 'https://graph.oculus.com/user_nonce_validate?nonce=USER_PROOF&user_id=USER_ID&access_token=ACCESS_TOKEN' NOTE: The nonce is only good for one check and then it is invalidated.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun getUserProof(): UserProof
Returns
UserProof  The user proof for the logged-in user.
launchBlockFlow ( userId )
Launch the flow for blocking the given user. You can't follow, be followed, invited, or searched by a blocked user, for example. You can remove the block via ovr_User_LaunchUnblockFlow.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun launchBlockFlow(userId: String): LaunchBlockFlowResult
Parameters
userId: String
Returns
LaunchBlockFlowResult  The result of the launch block flow request.
launchUnblockFlow ( userId )
Launch the flow for unblocking a user that the viewer has blocked.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun launchUnblockFlow(userId: String): LaunchUnblockFlowResult
Parameters
userId: String
Returns
LaunchUnblockFlowResult  The result of the launch unblock flow request.
sendAuthUrl ( authUrl )
Allows apps to initiate a login flow using the Meta Horizon App on a mobile device. The auth_url will be sent to the Horizon Mobile App and the user will be redirected to the auth_url to complete the login flow.
This method can return the following status codes: common status codes in UsersStatusCode.
Signature
suspend fun sendAuthUrl(authUrl: String): Intent
Parameters
authUrl: String
Returns
Intent  Intent - Returns an Intent that must be passed to Activity.startActivityForResult(Intent, int) (or similar) in order to send auth_url to Mobile app. The activity will prompt the user whether to allow sending auth_url.