Class Credentials
A class, representing the credentials used for authenticating a User.
Namespace: Realms.Sync
Assembly: Realm.dll
Syntax
public class Credentials
Properties
| Improve this Doc View SourceIdentityProvider
Gets the identity provider for the credentials.
Declaration
public string IdentityProvider { get; }
Property Value
Type | Description |
---|---|
String | The identity provider, such as Google, Facebook, etc. |
Token
Gets the access token.
Declaration
public string Token { get; }
Property Value
Type | Description |
---|---|
String | The access token. |
UserInfo
Gets additional user information associated with the credentials.
Declaration
public IReadOnlyDictionary<string, object> UserInfo { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<String, Object> | A dictionary, containing the additional information. |
Methods
| Improve this Doc View SourceAnonymous()
Creates Credentials for an anonymous user. These can only be used once - using them a second time will result in a different user being logged in. If you need to get a user that has already logged in with the Anonymous credentials, use Current or AllLoggedIn.
Declaration
public static Credentials Anonymous()
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
AzureAD(String)
Creates Credentials based on an Active Directory login.
Declaration
public static Credentials AzureAD(string adToken)
Parameters
Type | Name | Description |
---|---|---|
String | adToken | An access token, obtained by logging into Azure Active Directory. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
Custom(String, String, IDictionary<String, Object>)
Creates an instance of Credentials with a custom provider and user identifier.
Declaration
public static Credentials Custom(string identityProvider, string userIdentifier, IDictionary<string, object> userInfo)
Parameters
Type | Name | Description |
---|---|---|
String | identityProvider | Provider used to verify the credentials. |
String | userIdentifier | String identifying the user. Usually a username of id. |
IDictionary<String, Object> | userInfo | Data describing the user further or null if the user does not have any extra data. The data will be serialized to JSON, so all values must be mappable to a valid JSON data type. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
Facebook(String)
Creates Credentials based on a Facebook login.
Declaration
public static Credentials Facebook(string facebookToken)
Parameters
Type | Name | Description |
---|---|---|
String | facebookToken | A Facebook authentication token, obtained by logging into Facebook. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
Google(String)
Creates Credentials based on a Google login.
Declaration
public static Credentials Google(string googleToken)
Parameters
Type | Name | Description |
---|---|---|
String | googleToken | A Google authentication token, obtained by logging into Google. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
JWT(String, String)
Creates Credentials based on a JWT access token.
Declaration
public static Credentials JWT(string token, string providerName = "jwt")
Parameters
Type | Name | Description |
---|---|---|
String | token | A Json Web Token, obtained by logging into your auth service. |
String | providerName | The name of the jwt provider in ROS. By default, it will be jwt, unless explicitly overridden by the ROS configuration. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
Nickname(String, Boolean)
Creates Credentials based on a login with a nickname. If multiple users try to login with the same nickname, they'll get the same underlying sync user.
Declaration
public static Credentials Nickname(string value, bool isAdmin = false)
Parameters
Type | Name | Description |
---|---|---|
String | value | The nickname of the user. |
Boolean | isAdmin | An optional parameter controlling whether the user is admin. |
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |
UsernamePassword(String, String, Boolean)
Creates Credentials based on a login with a username and a password.
Declaration
public static Credentials UsernamePassword(string username, string password, bool createUser)
Parameters
Type | Name | Description |
---|---|---|
String | username | The username of the user. |
String | password | The user's password. |
Boolean | createUser |
|
Returns
Type | Description |
---|---|
Credentials | An instance of Credentials that can be used in LoginAsync(Credentials, Uri) |