overwolf.profile API
Use this API to get Overwolf information for the current user of the app (e.g user name, user log-in event, etc.)
Permissions required: profile
Methods Reference
- overwolf.profile.getCurrentUser()
- overwolf.profile.refreshUserProfile()
- overwolf.profile.openLoginDialog()
Events Reference
Types Reference
- overwolf.profile.GetCurrentUserResult Object
- overwolf.profile.LoginStateChangedEvent Object
- overwolf.profile.ConnectionState Enum
getCurrentUser(callback)
Version added: 0.78
Calls the given callback with the currently logged-in Overwolf user.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetCurrentUserResult) => void | A function called with the current user, or an error. |
refreshUserProfile(callback)
Version added: 0.128
Fetches user profile from server, then invokes the callback with the currently logged-in Overwolf user.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetCurrentUserResult) => void | A function called with the current user, or an error. |
openLoginDialog()
Version added: 0.80
Opens the login dialog.
onLoginStateChanged
Version added: 0.78
Fired when a user logged in or logged out, with the following structure: LoginStateChangedEvent Object
GetCurrentUserResult Object
Parameter | Type | Description |
---|---|---|
success | boolean | inherited from the "Result" Object |
error | string | inherited from the "Result" Object |
status | string | deprecated. For backward compatibility only |
Reason | string | deprecated. For backward compatibility only |
username | string | unique identifier. null for not logged-in users |
userId | string | see note |
machineId | string | |
partnerId | int | |
channel | string | |
parameters | string | |
installParams | JSON | see Creating Download Link |
avatar | string | |
installerExtension | string | |
displayName | string |
Note: userId is not a unique identifier
The term userId
might be a bit misleading: it's not a unique identifier for an Overwolf user.
The userId is unique for each OW client installation on the current machine, so it's more like "clientID".
We use it to identify not logged-in users on the machine.
On a Windows computer, with multiple users - there might be multiple userIds
but a single MachineId
;
To uniquely identify logged-in users, you should use the username
(this field will be null for not logged-in user).
Each user has to pick a unique OW username upon registering. Even If he logged in through Google, Discord, etc. - OW automatically generate a unique user name for him.
So at the bottom line, you can always count on the username to be a unique identifier for logged-in users.
Example data: Success
{
"success": true,
"error": "",
"username":"itaygl",
"userId":"OW_34153336-192b-44f6-aa0f-4a9b744c689d",
"machineId":"653000ad-001c-43e9-a5c9-e23db5ad370a",
"partnerId":0,
"channel":"website",
"displayName": "itay gl",
"avatar": "https://lh5.googleusercontent.com/-vvsdlz7W2oM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reB9VADjY3FzaTDSA7-Adrsny38xg/mo/photo.jpg?sz=50",
"installParams": "{source: "", medium: "", campaign: "", term: "", content: """,
}
Example data: Failure
If the user is not logged-in, the success
will be false
, but you’ll still get the rest of the available data (userId, machineId, etc.)
{
"success": false,
"error": "Not signed in",
"status":"error",
"reason":"Not signed in",
"username":null,
"userId":"OW_34153336-192b-44f6-aa0f-4a9b744c689d",
"machineId":"653000ad-001c-43e9-a5c9-e23db5ad370a",
"partnerId":0,
"channel":"website",
"parameters":{"no-ftue":null},
"installParams":null,
"avatar":""
}
LoginStateChangedEvent Object
Parameter | Type | Description |
---|---|---|
status | string | |
connectionState | ConnectionState enum | |
username | string |
Event data example: Success
{
"status": "success",
"connectionState": "Online", // can be "Online", "Offline", "Connecting", etc.
"username": "..." // when the status is other than "Offline", will be the currently connected username.
}
ConnectionState enum
Option | Description |
---|---|
Unknown | |
Offline | |
Connecting | |
Online | |
Disconnecting |