Example test page for OAuth authentication
The following test page, usable on a Java or .NET website, 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>
</head>
<body>
<form method="post" action="MYPROT://MYHOST:MYPORT/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" />
<input type="hidden" id="grant_type" name="grant_type" value="client_credentials" />
<br/>
<input type="submit" value="Get token"/>
</fieldset>
</body>
In this example, make the following replacements:
| String | Replace with |
|---|---|
| MYPROT | https if you use HTTPS. http otherwise |
| MYHOST | The hostname of the server that contains the Content Delivery web service |
| MYPORT | The port number to use for the Content Delivery web service |
| MYID | A valid user name |
| MYSECRET | The shared secret |
Open this webpage 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}