Source for file index.php
Documentation is available at index.php
<title>HTTP_OAuth Example Tool</title>
<style type="text/css" media="all">@import "styles.css";</style>
<style type="text/css" media="all">@import "thickbox.css";</style>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.cookie.js" type="text/javascript"></script>
<script src="jquery.fade.js" type="text/javascript"></script>
<script src="thickbox.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input').each(function() {
if (this.value.length < 1) {
this.value = $.cookie(this.id);
$('.add-argument').click(function() {
var add = $(this).siblings('div').eq(0).clone();
add.children('input').val('');
if ($('#verifier').val().length > 1) {
$('#authorize-url-code').show();
activate_request_token();
$('.into-html').click(function() {
$(this).html($(this).text());
function activate_request_token() {
$('#fetch_request_token').removeClass('disabled').click(function() {
consumer_key: $('#consumer_key').val(),
consumer_secret: $('#consumer_secret').val(),
request_token_url: $('#request_token_url').val(),
callback_url: window.location.toString(),
method: $('#request_token_method').val()
if ($('#request_token_method').val() == 'POST') {
$('#request_token_arguments > div.argument').each(function() {
data['args[' + $(this).children('input').eq(0).val() + ']'] =
$(this).children('input').eq(1).val();
url: "request_token.php",
success: function(json) {
if (json.token === undefined || json.token_secret === undefined) {
$('#token').val(json.token).vkfade();
$('#token_secret').val(json.token_secret).vkfade();
success('Got request token! ready to open authorize url');
$('#request-token-code').show();
function activate_authorize() {
$('#open_authorize_url').removeClass('disabled').click(function() {
var url = $('#authorize_url').val();
alert('Missing authorize url setting');
var token = $('#token').val();
alert('Missing request token!');
$('input').each(function() {
$.cookie(this.id, this.value);
window.location = url + '?oauth_token=' + token;
function activate_access_token() {
$('#fetch_access_token').removeClass('disabled').click(function() {
consumer_key: $('#consumer_key').val(),
consumer_secret: $('#consumer_secret').val(),
token: $('#token').val(),
token_secret: $('#token_secret').val(),
verifier: $('#verifier').val(),
access_token_url: $('#access_token_url').val(),
method: $('#access_token_method').val()
if ($('#access_token_method').val() == 'POST') {
$('#access_token_arguments > div.argument').each(function() {
data['args[' + $(this).children('input').eq(0).val() + ']'] =
$(this).children('input').eq(1).val();
success: function(json) {
if (json.token === undefined || json.token_secret === undefined) {
$('#token').val(json.token).vkfade();
$('#token_secret').val(json.token_secret).vkfade();
success('Got access token! ready to do oauth requests');
activate_oauth_request();
$('#access-token-code').show();
function activate_oauth_request() {
$('#oauth_request').removeClass('disabled').click(function() {
consumer_key: $('#consumer_key').val(),
consumer_secret: $('#consumer_secret').val(),
token: $('#token').val(),
token_secret: $('#token_secret').val(),
protected_resource: $('#protected_resource_url').val(),
method: $('#protected_resource_method').val()
if ($('#protected_resource_method').val() == 'POST') {
$('#protected_resource_arguments > div.argument').each(function() {
data['args[' + $(this).children('input').eq(0).val() + ']'] =
$(this).children('input').eq(1).val();
url: "oauth_request.php",
$('#oauth-request-code').show();
$('.defaults > select').change(function() {
var request_token_url = 'http://services.digg.com/1.0/endpoint?method=oauth.getRequestToken';
var authorize_url = 'http://digg.com/oauth/authorize';
var access_token_url = 'http://services.digg.com/1.0/endpoint?method=oauth.getAccessToken';
var request_token_url = 'http://twitter.com/oauth/request_token';
var authorize_url = 'http://twitter.com/oauth/authorize';
var access_token_url = 'http://twitter.com/oauth/access_token';
$('#protected_resource').val('http://twitter.com/account/verify_credentials.xml');
var request_token_url = 'https://www.google.com/accounts/OAuthGetRequestToken';
var authorize_url = 'https://www.google.com/accounts/OAuthAuthorizeToken';
var access_token_url = 'https://www.google.com/accounts/OAuthGetAccessToken';
$('#protected_resource').val('http://www.google.com/calendar/feeds/default/allcalendars/full?orderby=starttime');
var request_token_url = 'http://api.login.yahoo.com/oauth/v2/get_request_token';
var authorize_url = 'https://api.login.yahoo.com/oauth/v2/request_auth';
var access_token_url = 'https://api.login.yahoo.com/oauth/v2/get_token';
$('#protected_resource').val('http://social.yahooapis.com/v1/user/abcdef123/profile?format=json');
var request_token_url = 'http://api.myspace.com/request_token';
var authorize_url = 'http://api.myspace.com/authorize';
var access_token_url = 'http://api.myspace.com/access_token';
alert('Invalid default: ' + $(this).val());
$('#request_token_url').val(request_token_url);
$('#authorize_url').val(authorize_url);
$('#access_token_url').val(access_token_url);
$('.show-code').click(function() {
$(this).siblings('.code').toggle('fast');
$('#success').html(msg).show('fast').vkfade();
$('#error').hide('fast');
$('#error').html(msg).show('fast').vkfade();
$('#success').hide('fast');
$('.selector > span').click(function() {
$(this).addClass('selected');
$(this).siblings('.selected').removeClass('selected');
$(this).siblings('input').val(this.innerHTML);
if ($(this).siblings('input').val() == 'POST') {
$(this).parent().siblings('.arguments').show();
$(this).parent().siblings('.arguments').hide();
<form action="" id="settings-form">
<option value="myspace">MySpace</option>
<option value="yahoo">Yahoo!</option>
<option value="google">Google</option>
<option value="twitter">Twitter</option>
<option value="digg">Digg</option>
<div class="clear"></div>
<label for="">Consumer Key</label>
<input type="text" name="consumer_key" id="consumer_key">
<label for="">Consumer Secret</label>
<input type="text" name="consumer_secret" id="consumer_secret">
<span class="selected">GET</span>
<input type="hidden" id="request_token_method" value="GET" />
<label for="">Request Token URL</label>
<input type="text" name="request_token_url" id="request_token_url">
<div class="clear"></div>
<div style="display:none;" class="arguments" id="request_token_arguments">
<input type="text" class="argument" value="" id="" placeholder="name...">
<input type="text" class="argument" value="" id="" placeholder="value...">
<div class="clear"></div>
<a href="#" class="add-argument">Another argument...</a>
<label for="">Authorize URL</label>
<input type="text" value="" id="authorize_url" name="authorize_url">
<span class="selected">GET</span>
<input type="hidden" id="access_token_method" value="GET" />
<label for="">Access Token URL</label>
<input type="text" name="access_token_url" id="access_token_url">
<div class="clear"></div>
<div style="display:none;" class="arguments" id="access_token_arguments">
<input type="text" class="argument" value="" id="" placeholder="name...">
<input type="text" class="argument" value="" id="" placeholder="value...">
<div class="clear"></div>
<a href="#" class="add-argument">Another argument...</a>
<label for="">Token</label>
<input type="text" value="" id="token" readonly>
<label for="">Token Secret</label>
<input type="text" value="" id="token_secret" readonly>
<label for="">Verifier</label>
<input type="text" value="<?= @$_GET['oauth_verifier']; ?>" id="verifier">
<span class="selected">GET</span>
<input type="hidden" id="protected_resource_method" value="GET" />
<label for="">Protected resource</label>
<input type="text" name="protected_resource" id="protected_resource_url">
<div class="clear"></div>
<div style="display:none;" class="arguments" id="protected_resource_arguments">
<input type="text" class="argument" value="" id="" placeholder="name...">
<input type="text" class="argument" value="" id="" placeholder="value...">
<div class="clear"></div>
<a href="#" class="add-argument">Another argument...</a>
<div class="clear"></div>
<div class="into-html" id="success">
<div class="clear"></div>
<span><a id="fetch_request_token" class="disabled">Fetch request token</a></span>
<span><a id="open_authorize_url" class="disabled">Open authorize url</a></span>
<span><a id="fetch_access_token" class="disabled">Fetch access token</a></span>
<span><a id="oauth_request" class="disabled">OAuth request</a></span>
<div class="code" id="request-token-code">
<? highlight_file('request_token.php'); ?>
<div class="code" id="authorize-url-code">
<? highlight_file('authorize_url.php'); ?>
<div class="code" id="access-token-code">
<? highlight_file('access_token.php'); ?>
<div class="code" id="oauth-request-code">
<? highlight_file('oauth_request.php'); ?>
Documentation generated on Mon, 11 Mar 2019 15:55:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|