Gosuke Miyashita > WebService-JugemKey-Auth-0.04 > WebService::JugemKey::Auth

Download:
WebService-JugemKey-Auth-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

WebService::JugemKey::Auth - Perl interface to the JugemKey Authentication API

VERSION ^

Version 0.04

SYNOPSIS ^

  use WebService::JugemKey::Auth;

  my $api = WebService::JugemKey::Auth->new({
     api_key => '...',
     secret  => '...',
  });

  # create login uri
  my $uri = $api->uri_to_login({
      callback_url => 'http://your_callback_url_here/',
      param1 => 'value1',
      param2 => 'value2',
  });
  print $uri->as_string;

  # exchange frob for token
  my $frob = $q->param('frob');
  my $user = $api->get_token($frob) or die "Couldn't get token: " . $api->errstr;
  $user->name;
  $user->token;

  # get user info from token
  my $user = $api->get_user($token) or die "Couldn't get user: " . $api->errstr;
  $user->name;

DESCRIPTION ^

A simple interface for using the JugemKey Auththentication API. http://jugemkey.jp/api/auth/

METHODS ^

new({ api_key => '...', secret => '...' })

Contructs a WerbService::JugemKey::Auth object.It requires 'api_key' and 'secret' you can get from the JugemKey web site. (https://secure.jugemkey.jp/?mode=auth_top)

uri_to_login({ %options })

Returns a URI object that points the JugemKey login url with required parameters. You must specify callback_url parameter like this.

  uri_to_login({ callback_url => 'http://your_callback_url/' })

If you need a query string with the callback_url, you can specify it like this.

  uri_to_login({
      callback_url => 'http://your_callback_url/',
      param1       => 'value1',
      param2       => 'value2',
  })

In this example, a JugemKey user returns to http://your_callback_url/?param1=value1&param2=value2&frob=xxxxxxxxxxxxxxxx after authenticated by the JugemKey.A frob is used for getting a token and a user information.

get_token($frob)

Passes a frob to the JugemKey Auth API and returns a WebService::JugemKey::Auth::User object associated with the JugemKey user.This user object has some accessors for getting JugemKey user information.

name()

Returns an account name on the JugemKey.

token()

Returns a token associated with the JugemKey logged-in user. You can use this token for getting a user information again or authenticating with other paperboy&co. Web Service APIs.

get_user($token)

Passes a token to the JugemKey Auth API and returns a WebService::JugemKey::Auth::User object associated with the JugemKey user.This user object has some accessors for getting JugemKey user information.

name()

Returns an account name on the JugemKey.

api_sig($request)

Generates a message authentication code with HMAC_SHA1.

ua()

Set/Get a user-agent name.

SEE ALSO ^

JugemKey Authentication API http://jugemkey.jp/api/auth/

This module's interface and code are inspired by Hatena::API::Auth. Thanks to Naoya Ito and Hatena.

AUTHOR ^

Gosuke Miyashita, <gosukenator at gmail.com>

BUGS ^

Please report any bugs or feature requests to bug-webservice-jugemkey-auth at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-JugemKey-Auth. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc WebService::JugemKey::Auth

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2006 paperboy&co., all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: