OAuth Coding Examples

The following sections provide quick start examples of using OAuth in various common coding languages. BOSS API is providing this information to help you get up and running quickly with your BOSS API implementations. These self-serve samples are provided for you to use have been contributed by the BOSS User Community.

Note

Please make sure to add your "ADD YOUR KEY HERE" and "ADD YOUR SECRET HERE" in the appropriate places in the code examples below.

Note

All code samples below are adapted from original contributions. Contributors are noted.

PHP Example

  1. Sign up for OAuth application through https://developer.yahoo.com.
  2. Download the PHP OAuth Library from http://oauth.net/code. This is where you can retrieve the required OAuth.php file displayed below.
  3. Create a php script based on this example updating the $cc_key with your Consumer Key and the $cc_secret with your Consumer Secret:

Perl Example

Perl*

Perl 5.8+

Location: http://www.perl.org/get.html

extra mods:

http://search.cpan.org/dist/Net-OAuth/

http://search.cpan.org/dist/LWP-Protocol-socks/

http://search.cpan.org/~makamaka/JSON-2.53/lib/JSON.pm

* Specific CPAN Modules are required. Please see the code for required modules.

Ruby Example

Example: example.rb

Ruby

oauth_util.rb

Location: https://gist.github.com/383159

License: https://gist.github.com/375593

C# Example

Example: boss_test.cs

C#

Location: https://oauth.googlecode.com/svn/code/csharp/OAuthBase.cs

License: Unknown

Contributor: Bryan Meverovich

Java Example

Example: SignPostTest.java

Example: StHTTPRequest.java

Java

SignPost

Location: http://code.google.com/p/oauth-signpost/

License: http://www.apache.org/licenses/LICENSE-2.0

Contributor: David Hardtke

Apache Logger

Location: http://logging.apache.org/log4j/1.2/download.html

License: http://logging.apache.org/log4j/1.2/license.html

Node.JS Example

Example: Node.JS

Node.JS

Contributor: Heber Allred

Table of Contents