Skip to content

Trimble.ID.Maui

Trimble.ID.Maui

Represents a browser interface.

Closes the browser.

This method has no parameters.

Launches the specified URI in the browser.

Name Type Description
uri System.Uri The URI to launch.

Trimble.ID.Maui

Represents an interface for a mobile authenticator that exchanges authorization code for tokens.

Exchanges authorization code for tokens.

Name Type Description
query System.String Query string that contains state and authorization code.

Exchanges authorization code for tokens.

Name Type Description
state System.String The state parameter.
code System.String The authorization code.

Trimble.ID.Maui

An authenticator that utilizes a custom URI callback

const string CONFIGURATION_ENDPOINT = "https://id.trimble.com/.well-known/openid-configuration";
var endpointProvider = new OpenIdEndpointProvider(new Uri(CONFIGURATION_URL, UriKind.Absolute));
const string CLIENT_ID = "CLIENT_ID";
var string SCOPES = new [] { "SCOPE" };
var REDIRECT_URI = "REDIRECT_URI";
var options = new MobileAuthenticatorOptions
{
EndpointProvider = endpointProvider,
ClientId = CLIENT_ID,
Scopes = SCOPES,
#if WINDOWS
RedirectUri = LOCALHOST_REDIRECT_URI,
#else
RedirectUri = REDIRECT_URI,
#endif
EnableTokenPersistence = true
};
var authenticator = new MobileAuthenticator(options);
if (await authenticator.Login())
{
var userInfo = await authenticator.GetUserInfo();
var token = await authenticator.TokenProvider.RetrieveToken();
}
await authenticator.Logout(singleSignOut: true);

Implements IAuthenticator

#ctor(mobileAuthenticatorOptions) constructor

Section titled “#ctor(mobileAuthenticatorOptions) constructor”

Public constructor for MobileAuthenticator class

Name Type Description
mobileAuthenticatorOptions Trimble.ID.Maui.MobileAuthenticatorOptions The options for configuring the authenticator

#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor

Section titled “#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor”

Public constructor for MobileAuthenticator class

Name Type Description
endpointProvider Trimble.ID.IEndpointProvider An endpoint provider that provides the URL for the Trimble Identity authorization and token endpoints
clientId System.String The clientId of the calling application
scopes System.String[] The scopes used in the authorization request
redirectUri System.String The custom redirect URI scheme used for this authenticator
allowPersistenceStorage System.Boolean The allowPersistence helps to retrieve cached tokens on network calls. By default it is set to true. If false, no caching is done

Get the logged in state

Get the token provider for this authenticator

This token provider can be used with other SDK components

Get the token provider for this authenticator

This token provider can be used with other SDK components

Validates the ID token and returns user claims

User claims from the ID token

This method has no parameters.

Log the user in

true if the user was successfully logged in

Name Type Description
silent System.Boolean true if no UI should be shown i.e. prompt=none
timeoutInMs System.Int32 Specify the length of time that client waits for a login response when making a login attempt.Thedefault timeout value is 3 minutes.
Name Description
System.TimeoutException Login operation has timed out after waiting for specified time.

Only one login or logout operation is permitted at a time, all previously started operations will return false

Log the user out

true if the user was successfully logged out

Name Type Description
singleSignOut System.Boolean true if the single sign in session should be terminated

Only one login or logout operation is permitted at a time, all previously started operations will return false

Exchanges authorization code for tokens. This method is used in iOS and needs to be invoked to complete Login/Logout from the AppDelegate class.

Name Type Description
query System.String Query string that contains state and authorization code

Exchanges authorization code for tokens. This method is used in Android and needs to be invoked to complete Login/Logout flow from the Activity that handles application redirect.

Name Type Description
state System.String state parameter
code System.String authorization code

Fluent method to specify current activity

Name Type Description
activity Android.App.Activity Activity that launches the browser during authentication

Trimble.ID.Maui

Initializes a new instance of the MobileAuthenticatorOptions class

This constructor has no parameters.

Contains the options for configuring the authenticator

Gets or sets the client ID (required).

Gets or sets a value indicating whether token persistence is enabled. By default, this is set to true.

Gets or sets the endpoint provider for the mobile authenticator (required).

Gets or sets the redirect URI (required).

Gets or sets the scopes (required).

Trimble.ID.Maui

Retrieve access token

This method has no parameters.