-
Notifications
You must be signed in to change notification settings - Fork 0
MT::OAuth::Client
aklaswad edited this page Sep 14, 2010
·
1 revision
MT::OAuth::Client
my $client = MT::OAuth->client($provider); $client->access( @params );
特定のOAuth Service Providerへのアクセス手段を提供します。
システムレベルで、Service Providerに対するconsumer key およびconsumer key secretが入力済みかの真偽値を返します。
$client->registered or die 'set system setting before use OAuth';
指定したauthor_idについてのhandshakeが行われているかの真偽値を返します。author_idを指定しない場合、システムレベル(author_id==0)の判定を行います。
unless ( $client->has_token($author_id) ) { # redirect for handshake, or }
OAuth認証で保護されたリソースへのアクセスを行います。
return $client->access( author_id => $author->id, end_point => $url, post => { status => 'Hello?', }, retry => 1, callback => sub { return $app->return_to_dashboard(Msg => 'Successed'); }, );
- author_id
指定したauthor_idに紐づいたHandshakeを利用して認証を行います。
- end_point
アクセスするリソースのURLを指定します。
- post
HTTP POSTメソッドで追加したいパラメータを指定します。
- content
HTTP contentを指定します。
- content_type
HTTP content typeを指定します。
- retry
アクセスに失敗した時にHandshakeを行う場合、retryオプションを有効にします。
- redirect
アクセスに失敗した時にリダイレクトを行う場合、URLを指定します。
MTクラスのAppインスタンスが利用可能である必要があります。
- callback
アクセスの成功時に実行するサブルーチンのリファレンスを指定します。