Documentation Center

Example test page for OAuth authentication

The following test page, usable on a Java or .NET Web site, tests and demonstrates OAuth authentication.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
		  <title>Get token form.</title>
    <script type="text/javascript">
        function getToken() {
        }
    </script>
</head>
<body>
    <!-- Uncomment this when using the Java Web service 
    <form method="post" action="MYPROT://MYHOST:MYPORT/cd_webservice/access_token">
    -->

    <!-- Uncomment this when using the .NET Web service 
    <form method="post" action="MYPROT://MYHOST:MYPORT/access_token.svc/">
    -->
        <fieldset>
            <legend>Get a token</legend>
            <label for="client_id">Client ID:</label>
            <input type="text" id="client_id" name="client_id" value="MYID" />
            <br/>
            <label for="client_secret">Client secret:</label>
            <input type="text" id="client_secret" name="client_secret" value="MYSECRET" />
            <br/>
            <input type="submit" value="Get token"/>
        </fieldset>
</body>

In this example, make the following replacements:

StringReplace with
MYPROThttps if you use HTTPS. http otherwise
MYHOSTThe hostname of the server that contains the Content Delivery Web service
MYPORTThe port number to use for the Content Delivery Web service
MYIDA valid user name
MYSECRETThe shared secret

Open this Web page in a browser, fill in the fields and press Get token. The browser response should be a string like the following (long lines wrapped):

{"access_token":"client_id%3dtridion%26AllowedServices%3dcontentService%26Role%3dTridion+
test+account%26FirstName%3dSDL%26LastName%3dTridion%26expiresOn%3d1371139218053%26digest%3dVWsIQN0
IW6GeXbgfcAet2GHF6fEDl%2boBfQHFS6o4IoM%3d","expires_in":300}