OAuth Test Server
Instructions for Use
This is a test server with a predefined static set of keys and tokens, you can make your requests using them to test your code (and mine ;)).
Your Consumer Key / Secret
- consumer key:
key
- consumer secret:
secret
Use this key and secret for all your requests.
Getting a Request Token
- request token endpoint:
http://api.mh-freya-game.com/oauth/example/request_token.php
A successful request will return the following with new parameters returned in OAuth 2008.1:
oauth_token=requestkey&oauth_token_secret=requestsecret&oauth_expires_in=3600
An unsuccessful request will attempt to describe what went wrong using oauth_problem codes.
Example
http://api.mh-freya-game.com/oauth/example/request_token.php?oauth_version=1.0&oauth_nonce=b6cffd464d79f5e9e4616ab8badfc487&oauth_timestamp=1742058958&oauth_consumer_key=key&oauth_signature_method=HMAC-SHA1&oauth_signature=VEQMpmikVfgefUxxK7CwPKlmsis%3D
New in OAuth 2008.1
- oauth_expires_in: a parameter defining when (in seconds) the use of this token will expire. If any calls are made using this token after expiration, one of the various oauth_problem values.
- oauth_problem: a parameter sent when an oauth request failed. The value will be a code representing the reason for failure. Refer to the the list of oauth problem codes.
Getting an Access Token
The Request Token provided above is already authorized, you may use it to request an Access Token right away.
- access token endpoint:
http://api.mh-freya-game.com/oauth/example/access_token.php
A successful request will return the following with new parameters returned in OAuth 2008.1:
oauth_token=accesskey&oauth_token_secret=accesssecret&oauth_session_handle=sessionhandle&oauth_expires_in=3600&oauth_authorization_expires_in=3600
An unsuccessful request will attempt to describe what went wrong.
Example
http://api.mh-freya-game.com/oauth/example/access_token.php?oauth_version=1.0&oauth_nonce=dbbe20b9d9d46b73669c8c43b515babd&oauth_timestamp=1742058958&oauth_consumer_key=key&oauth_token=requestkey&oauth_signature_method=HMAC-SHA1&oauth_signature=lUjcoZi65%2BH1n5XRj618DJv6LZk%3D
New in OAuth 2008.1
- oauth_session_handle: The session handle is used to identify a session after an access token expires. A session handle is saved by the client and is only passed to the oauth server during an access token renewal request.
- oauth_authorization_expires_in: Similar to oauth_expires_in, defines how many seconds until the session handle will expire.
New in OAuth 2008.1: Renewing an Access Token
A feature new in OAuth 2008.1 is access token renewal. When access tokens expire, you must acquire a new token using the renewal api.
- access token renewal endpoint:
http://api.mh-freya-game.com/oauth/example/access_token_renewal.php
A successful request will return the following:
oauth_token=accesskey&oauth_token_secret=accesssecret&oauth_session_handle=sessionhandle&oauth_expires_in=3600&oauth_authorization_expires_in=3600
An unsuccessful request will attempt to describe what went wrong.
Example
http://api.mh-freya-game.com/oauth/example/renew_access_token.php?oauth_version=1.0&oauth_nonce=75d98c7f35a893a9bd496ec3b1aed131&oauth_timestamp=1742058958&oauth_consumer_key=key&oauth_token=accesskey&oauth_session_handle=sessionhandle&oauth_signature_method=HMAC-SHA1&oauth_signature=9vZKDpUqRjz1Tx4aokWHU8hyjKY%3D
Making Authenticated Calls
Using your Access Token you can make authenticated calls.
- api endpoint:
http://api.mh-freya-game.com/oauth/example/echo_api.php
A successful request will echo the non-OAuth parameters sent to it, for example:
method=foo&bar=baz
An unsuccessful request will attempt to describe what went wrong.
Example
http://api.mh-freya-game.com/oauth/example/echo_api.php?oauth_version=1.0&oauth_nonce=bbfcd1def663b31f69cd40a7bbe77ee9&oauth_timestamp=1742058958&oauth_consumer_key=key&method=foo%2520bar&bar=baz&oauth_token=accesskey&oauth_signature_method=HMAC-SHA1&oauth_signature=IB01o7sVgr2CYnm%2Bfw4fYjp0PO8%3D
Currently Supported Signature Methods
Current signing method is: HMAC-SHA1
Further Resources
There is also a test client implementation in here.
The code running this example can be downloaded from the PHP section of the OAuth google code project: http://code.google.com/p/oauth/