Catalyst-Authentication-Credential-Twitter

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    application.

METHODS
    As per guidelines of Catalyst::Plugin::Authentication, there are two
    mandatory methods, "new" and "authenticate". Since this is not really
    enough for the Twitter API, I've added one more.

  new()
    Will not be called by you directly, but will use the configuration you
    provide (see above). Mandatory parameters are "consumer_key",
    "consumer_secret" and "callback_url". Note that you can also include
    "twitter_consumer_key", "twitter_consumer_secret", and
    "twitter_callback_url" as variables in your Catalyst site configuration
    or yml file and you don't need to pass configuration parameters in your
    MyApp.pm file. Please see Net::Twitter for more details on them.

  authenticate_twitter_url( $c )
    This method will return the authentication URL. Bounce your users there
    before calling the "authentication" method.

  authenticate( )
    Handles the authentication. Nothing more, nothing less. It returns a
    Catalyst::Authentication::User::Hash with the following keys (all coming
    straight from Twitter).

    twitter_user
    twitter_user_id
    twitter_access_token
    twitter_access_token_secret

    Your database must at least contain a column called "twitter_user_id" in
    your main user table. If the other keys are present they will be updated
    on login with Twitter's most up-to-date information for that user.

  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).

  twitter_user()
    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:

        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 ) {
                $user = $self->model->create_user( $twitter->twitter_user );
            }

            # etc
        }

AUTHOR
    Jesse Stay <jesse@staynalive.com> <http://staynalive.com>

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

    The full text of the license can be found in the LICENSE file included
    with this module.

SEE ALSO
    Catalyst::Plugin::Authentication, Net::Twitter

BUGS
    "Bugs? Impossible!". Please report bugs to
    <http://rt.cpan.org/Ticket/Create.html?Queue=Catalyst-Authentication-Cre
    dential-Twitter>

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



( run in 0.454 second using v1.01-cache-2.11-cpan-df04353d9ac )