Click or drag to resize

AgentFactoryFindByAuthenticationToken Method

Find an agent using his authentication token for the specified module.

Namespace:  AskiaFieldCom
Assembly:  AskiaFieldCom (in AskiaFieldCom.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static IResult<IAgent> FindByAuthenticationToken(
	IContext context,
	string token,
	IModule module = null
)

Parameters

context
Type: AskiaFieldComIContext
Context of execution.
token
Type: SystemString
Authentication token of the agent to find.
module (Optional)
Type: AskiaFieldComIModule
Module associated with the authentication token. If null the method will use the module from the context.

Return Value

Type: IResultIAgent
Returns the instance of agent or a fail result.
Remarks
Mostly return the ItemNotFoundException in case of failure.
Remarks
If the module is not specified, this method will search using the module in the context (Connection, ModuleName).
Examples

Find an agent using his authentication token and the current context module.

var result = AgentFactory.FindByAuthenticationToken(context, "A-7f6738dd-8087-4469-81eb-fa96027a1f54");
if (!result.Success) throw result.Exception;
var agent = result.Value;
Console.WriteLine($"Agent {agent.FirstName} {agent.LastName} is found.");
See Also