Class User
This class manages the state of a Kinvey user. User methods can be accessed through this class, and the active user of an app is an instance of this class. Login methods are implemented as static methods on this class, and will set the active user.
Inheritance
Namespace: Kinvey
Assembly: Kinvey.dll
Syntax
public class User : JObject
Fields
| Improve this Doc View SourceAttributes
A name-value dictionary of custom attributes of the user
Declaration
public Dictionary<string, JToken> Attributes
Field Value
Type | Description |
---|---|
Dictionary<System.String, JToken> | The Attributes field gets/sets the value of the Dictionary type which contains user's attributes. |
UserCollectionName
The name of the user collection.
Declaration
public const string UserCollectionName = null
Field Value
Type | Description |
---|---|
System.String | The UserCollectionName field gets the value of the string type which contains a name of a user collection. |
Properties
| Improve this Doc View SourceAccessToken
Gets or sets the access token.
Declaration
public string AccessToken { get; set; }
Property Value
Type | Description |
---|---|
System.String | The access token. |
Active
A boolean flag to know whether the current user is active.
Declaration
public bool Active { get; }
Property Value
Type | Description |
---|---|
System.Boolean | The Active property gets the value of the bool type. If it is true, a user is active. |
AuthSocialID
The _socialIdentity object.
Declaration
public KinveyAuthSocialID AuthSocialID { get; set; }
Property Value
Type | Description |
---|---|
KinveyAuthSocialID | The AuthSocialID property gets/sets the value of the KinveyAuthSocialID field, socialIdentity. |
AuthToken
Gets or sets the auth token.
Declaration
public string AuthToken { get; set; }
Property Value
Type | Description |
---|---|
System.String | The auth token. |
Disabled
If a user is disabled.
Declaration
public bool Disabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | The Disabled property gets the value of the bool type. If the value is true, a user is disabled. |
Id
Gets or sets the identifier.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
System.String | The identifier. |
KinveyClient
Gets the kinvey client.
Declaration
public AbstractClient KinveyClient { get; }
Property Value
Type | Description |
---|---|
AbstractClient | The kinvey client. |
Metadata
Gets or sets the name of the user.
Declaration
public KinveyUserMetaData Metadata { get; set; }
Property Value
Type | Description |
---|---|
KinveyUserMetaData | The name of the user. |
UserName
Gets or sets the name of the user.
Declaration
public string UserName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the user. |
Methods
| Improve this Doc View SourceDeleteAsync(String, Boolean, CancellationToken)
Remove the user with the specified user ID, with a flag for hard delete
Declaration
public Task<KinveyDeleteResponse> DeleteAsync(string userID, bool hard, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | The user ID of user to delete. |
System.Boolean | hard | If set to |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<KinveyDeleteResponse> | The async task. |
EmailVerificationAsync(String, CancellationToken)
Sends a verification email
Declaration
public Task<User> EmailVerificationAsync(string userID, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | Userid. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
ForgotUsername(String, AbstractClient, CancellationToken)
Sends an email to the provided email address if a user forgot their username.
Declaration
public static Task ForgotUsername(string email, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | Email address used to send username info. |
|
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task | The async task. |
GetMICAccessTokenAsync(String, String, AbstractClient, CancellationToken)
Gets the MIC access token, given the grant code passed in.
Declaration
public static Task GetMICAccessTokenAsync(String token, string micID = null, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
String | token | Grant token passed back from MIC grant request. |
System.String | micID | [optional] Auth Service ID. |
AbstractClient | userClient | [optional] Client that the user is logged in, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task | The async task. |
HasUser(String, AbstractClient, CancellationToken)
Checks to see if the given username already exists.
Declaration
public static Task<bool> HasUser(string username, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | Username to check |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<System.Boolean> | True if the username currently exists, otherwise false. |
IsActive()
If a user is active.
Declaration
public bool IsActive()
Returns
Type | Description |
---|---|
System.Boolean | If it is true, a user is active. |
LoginAsync(AbstractClient, CancellationToken)
Login a new, anonymous Kinvey user, without any specified details.
Declaration
public static Task<User> LoginAsync(AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The user that is logged into the app. |
LoginAsync(ThirdPartyIdentity, AbstractClient, CancellationToken)
Login with a third party identity
Declaration
public static Task<User> LoginAsync(ThirdPartyIdentity identity, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
ThirdPartyIdentity | identity | The Third party identity. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginAsync(String, String, AbstractClient, CancellationToken)
Login with a specified username and password.
Declaration
public static Task<User> LoginAsync(string username, string password, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | Username. |
System.String | password | Password. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginAuthlinkAsync(String, String, CancellationToken)
Login with Auth Link Credentials
Declaration
public Task<User> LoginAuthlinkAsync(string accesstoken, string refreshtoken, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accesstoken | Auth Link Accesstoken. |
System.String | refreshtoken | Auth Link Refreshtoken. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginFacebookAsync(String, AbstractClient, CancellationToken)
Login with Facebook Credentials
Declaration
public static Task<User> LoginFacebookAsync(string accessToken, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accessToken | Facebook Access token. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginGoogleAsync(String, AbstractClient, CancellationToken)
Login with Google Credentials
Declaration
public static Task<User> LoginGoogleAsync(string accessToken, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accessToken | Google Access token. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginLinkedinAsync(String, String, String, String, AbstractClient, CancellationToken)
Login with LinkedIn Credentials
Declaration
public static Task<User> LoginLinkedinAsync(string accesstoken, string accesstokensecret, string consumerkey, string consumersecret, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accesstoken | Linkedin Accesstoken. |
System.String | accesstokensecret | Linkedin Accesstokensecret. |
System.String | consumerkey | Linkedin Consumerkey. |
System.String | consumersecret | Linkedin Consumersecret. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginMICAsync(ThirdPartyIdentity, AbstractClient, CancellationToken)
Login with a third party identity
Declaration
public static Task<User> LoginMICAsync(ThirdPartyIdentity identity, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
ThirdPartyIdentity | identity | The Third party identity. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginMICWithAccessTokenAsync(String, CancellationToken)
Login with MIC Credentials
Declaration
public static Task<User> LoginMICWithAccessTokenAsync(string accessToken, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accessToken | MIC Access token. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginSalesforceAsync(String, String, String, String, AbstractClient, CancellationToken)
Login with Salesforce Credentials
Declaration
public static Task<User> LoginSalesforceAsync(string access, string reauth, string clientid, string id, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | access | Salesforce Access. |
System.String | reauth | Salesforce Reauth. |
System.String | clientid | Salesforce Clientid. |
System.String | id | Salesforce Identifier. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginTwitterAsync(String, String, String, String, AbstractClient, CancellationToken)
Login with Twitter Credentials
Declaration
public static Task<User> LoginTwitterAsync(string accesstoken, string accesstokensecret, string consumerkey, string consumersecret, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | accesstoken | Twitter Accesstoken. |
System.String | accesstokensecret | Twitter Accesstokensecret. |
System.String | consumerkey | Twitter Consumerkey. |
System.String | consumersecret | Twitter Consumersecret. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
LoginWithAuthorizationCodeAPIAsync(String, String, String, AbstractClient, CancellationToken)
Performs MIC Login authorization through an API.
Declaration
public static Task LoginWithAuthorizationCodeAPIAsync(string username, string password, string redirectURI, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | Username for authentication |
System.String | password | Password for authentication |
System.String | redirectURI | The redirect URI to be used for parsing the grant code |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task | The async task. |
LoginWithAuthorizationCodeLoginPage(String, KinveyMICDelegate<User>, AbstractClient, CancellationToken)
Performs MIC Login authorization through a login page.
Declaration
public static void LoginWithAuthorizationCodeLoginPage(string redirectURI, KinveyMICDelegate<User> MICDelegate, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURI | The redirect URI to be used for parsing the grant code |
KinveyMICDelegate<User> | MICDelegate | MIC Delegate, which has a callback to pass back the URL to render for login, as well as success and error callbacks. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
LoginWithMIC(String, KinveyMICDelegate<User>, String, AbstractClient, CancellationToken)
Performs MIC Login authorization through a login page.
Declaration
public static void LoginWithMIC(string redirectURI, KinveyMICDelegate<User> MICDelegate, string micID = null, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURI | The redirect URI to be used for parsing the grant code |
KinveyMICDelegate<User> | MICDelegate | MIC Delegate, which has a callback to pass back the URL to render for login, as well as success and error callbacks. |
System.String | micID | [optional] Auth Service ID. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
LoginWithMIC(String, String, String, AbstractClient, CancellationToken)
Performs MIC Login authorization through an API.
Declaration
public static Task LoginWithMIC(string username, string password, string micID = null, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | Username for authentication |
System.String | password | Password for authentication |
System.String | micID | [optional] Auth Service ID |
AbstractClient | userClient | [optional] Client that the user is logged in, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task | The async task. |
LoginWithMIC(String, String, String, String, AbstractClient, CancellationToken)
Performs MIC Login authorization through an API.
Declaration
public static Task LoginWithMIC(string username, string password, string redirectURI, string micID = null, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | Username for authentication |
System.String | password | Password for authentication |
System.String | redirectURI | The redirect URI to be used for parsing the grant code |
System.String | micID | [optional] Auth Service ID |
AbstractClient | userClient | [optional] Client that the user is logged in, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task | The async task. |
Logout()
Logout the current user.
Declaration
public void Logout()
LookupAsync(UserDiscovery, CancellationToken)
User Discovery Lookup of users, based on supplied criteria.
Declaration
public Task<User[]> LookupAsync(UserDiscovery criteria, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
UserDiscovery | criteria | UserDiscovery object which contains the lookup criteria. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User[]> | The async task which will return an array of User objects. |
RefreshAsync(CancellationToken)
Refresh this user object with latest data.
Declaration
public Task<User> RefreshAsync(CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The up-to-date user object. |
RegisterRealtimeAsync(AbstractClient, CancellationToken, RealtimeReconnectionPolicy)
Registers the active user for realtime messaging.
Declaration
public Task RegisterRealtimeAsync(AbstractClient userClient = null, CancellationToken ct = null, RealtimeReconnectionPolicy realtimeReconnectionPolicy = RealtimeReconnectionPolicy.EXPONENTIAL)
Parameters
Type | Name | Description |
---|---|---|
AbstractClient | userClient | [optional] User client. |
CancellationToken | ct | [optional] Ct. |
RealtimeReconnectionPolicy | realtimeReconnectionPolicy | [optional] Realtime reconnection policy |
Returns
Type | Description |
---|---|
Task | The realtime. |
ResetPasswordAsync(String, CancellationToken)
Resets the password for the specified user ID.
Declaration
public static Task<User> ResetPasswordAsync(string userID, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | The user ID of the user whose password is reset. This can either be the ID of the user, or the email address of the user. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
RetrieveAsync(String, CancellationToken)
Retrieve the specified User
Declaration
public Task<User> RetrieveAsync(string userID, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | Userid. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | Task which returns the requested user |
RetrieveAsync(String, String[], Int32, Boolean, CancellationToken)
Resolve the specified query, resolves, resolve_depth, retain to get a set of users
Declaration
public Task<User[]> RetrieveAsync(string query, string[] resolves, int resolveDepth, bool retain, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Query used to filter the results |
System.String[] | resolves | Resolves |
System.Int32 | resolveDepth | Resolve depth |
System.Boolean | retain | If set to |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User[]> | Task which returns an array of the requested users |
SignupAsync(String, String, Dictionary<String, JToken>, AbstractClient, CancellationToken)
Create a new Kinvey user, with the specified username and password.
Declaration
public static Task<User> SignupAsync(string username, string password, Dictionary<string, JToken> customFieldsAndValues = null, AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | The username of the new user. |
System.String | password | The password of the new user. |
Dictionary<System.String, JToken> | customFieldsAndValues | [optional] Custom key/value pairs to be added to user at creation. |
AbstractClient | userClient | [optional] Client that the user is logged in for, defaulted to SharedClient. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The newly created user. |
UnregisterRealtimeAsync(AbstractClient, CancellationToken)
Unregisters the active user from realtime messaging.
Declaration
public Task UnregisterRealtimeAsync(AbstractClient userClient = null, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
AbstractClient | userClient | [optional] User client. |
CancellationToken | ct | [optional] Ct. |
Returns
Type | Description |
---|---|
Task | The realtime. |
UpdateAsync(CancellationToken)
Updates the current user.
Declaration
public Task<User> UpdateAsync(CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |
UpdateAsync(User, CancellationToken)
Updates the specified user.
Declaration
public Task<User> UpdateAsync(User user, CancellationToken ct = null)
Parameters
Type | Name | Description |
---|---|---|
User | user | User. |
CancellationToken | ct | [optional] CancellationToken used to cancel the request. |
Returns
Type | Description |
---|---|
Task<User> | The async task. |