The agent API allows your web application to directly read or write an OpenToken package.

Instantiate the OpenToken Agent by invoking a constructor and loading the agent-config.txt configuration file that you saved in Configuring an OpenToken SP Adapter instance. This configuration file includes the name of the cookie that the agent object will write, as well as the key to use when encrypting a new OpenToken. If the agent does not find an agent-config.txt file, it throws an exception.

Sample code

Modify your .NET application based on the following sample code.

using System;using System.
using System.Text;
using opentoken;
using System.IO;
using opentoken.util;
using System.Collections;
using System.Collections.Generic;
. . . .
Agent agent = new Agent( “<PATH_TO_FILE>/agent-config.txt”);