Developer Center

Approver.com Developer Center > Developer Documentation > C# Code Examples

GetToken API - C# Example

This example retrieves an authentication token. It is used with Approver.com Web services authentication. This example assumes that your application has previously obtained a frob using the GetFrob API and that the user has authenticated with that frob on the Approver.com login page.

// Compile from the command line:  csc GetTokenExample.cs
 
using System;
using System.IO;
using System.Net;
using System.Xml;
 
public class GetTokenExample
{
    private const String API_ENDPOINT = "http://api.approver.com/v1/";
 
    // TODO: Change these constants to values that work for you.
    private const String APP_KEY = "bwhjdwvzysulefguwmfqlditbfbkhe";
    private const String TOKEN = "uhdikfyrmghwvsrxrwhe";
 
    public static void Main()
    {
        XmlDocument xd = new XmlDocument();
        xd.Load(API_ENDPOINT + "getToken.aspx?app_key=" + APP_KEY + 
            "&frob=ddlbdapqldb");
        Console.WriteLine(xd.SelectSingleNode("/auth/token").InnerText);
    }
}