Catalyst-Authentication-Credential-Twitter

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN


## authenticate\_twitter( )

Only performs the twitter authentication. Returns a hashref containing
the user's information given by Twitter (see `authenticate()` above for
the lists of keys returned), or undef if the authentication failed.

## twitter\_user($c)

Contains the user's twitter information after a successful twitter
authentication via `authenticate_twitter()` or
`authenticate()`. Useful if, for example, you want to create users
on-the-fly:

```perl
sub twitter_callback :Path( 'twitter/callback' ) {
    my ($self, $c) = @_;

    my $twitter = $c->get_auth_realm('twitter')->credential;
    my $user =  $twitter->authenticate( $c );

    # properly authenticated against twitter,
    # user just doesn't exist yet
    if ( !$user and  $twitter->twitter_user($c) ) {
        $user = $self->model->create_user( $twitter->twitter_user($c) );
    }

    # etc
}
```

# SEE ALSO

[Catalyst::Plugin::Authentication](https://metacpan.org/pod/Catalyst::Plugin::Authentication), [Net::Twitter](https://metacpan.org/pod/Net::Twitter)

# BUGS AND LIMITATIONS

`Catalyst::Authentication::Credential::Twitter` works well 
with [Catalyst::Authentication::Store::DBIx::Class](https://metacpan.org/pod/Catalyst::Authentication::Store::DBIx::Class), but might 
have problem with other stores, as its `authenticate()` method uses

```perl
$realm->find_user({
    twitter_user_id => $authenticated_twitter_id
}, $c);
```

to find the user. If this causes a problem for your store, 
you can get around it by using `authenticate_twitter()` and
accessing the store manually.

Please report bugs to [http://rt.cpan.org/Ticket/Create.html?Queue=Catalyst-Authentication-Credential-Twitter](http://rt.cpan.org/Ticket/Create.html?Queue=Catalyst-Authentication-Credential-Twitter)

# THANKS

Thanks go out Daisuke Murase for writing C::P::A::Credential::Flickr,
Marc Mims and Chris Thompson for Net::Twitter.

# AUTHORS

- Jesse Stay <jesse@staynalive.com>
- Yanick Champoux <yanick@cpan.org> [![endorse](http://api.coderwall.com/yanick/endorsecount.png)](http://coderwall.com/yanick)

# COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Jesse Stay.

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



( run in 4.634 seconds using v1.01-cache-2.11-cpan-df04353d9ac )