EveOnline-SSO
    
    
  
  
  
view release on metacpan or search on metacpan
    use EveOnline::SSO;
    my $sso = EveOnline::SSO->new(client_id => '03ed7324fe4f455', client_secret => 'bgHejXdYo0YJf9NnYs');
    
    # return url for open in browser
    print $sso->get_code();
    # or
    print $sso->get_code(state => 'some_ids_or_flags');
    # or
    print $sso->get_code(state => 'some_ids_or_flags', scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1');
    # return hash with access and refresh tokens by auth code
    print Dumper $sso->get_token(code=>'tCaVozogf45ttk-Fb71DeEFcSYJXnCHjhGy');
    # or hash with access and refresh tokens by refresh_token
    print Dumper $sso->get_token(refresh_token=>'berF1ZVu_bkt2ud1JzuqmjFkpafSkobqdso');
    
    # return hash with access and refresh tokens through listening light web-server
    print Dumper $sso->get_token_through_webserver(
                        scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1', 
                        state=> 'Awesome'
                    );
# DESCRIPTION
EveOnline::SSO is a perl module for get auth in https://eveonline.com through Single Sign-On (OAuth) interface.
# CONSTRUCTOR
- **new()**
    See available scopes on [https://developers.eveonline.com/](https://developers.eveonline.com/)
        # return url for open in browser
        print $sso->get_code();
        
        # or
        print $sso->get_code(state => 'some_ids_or_flags');
        
        # or
        print $sso->get_code(scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1');
- **get\_token()**
    Return hashref with access and refresh tokens.
    refresh\_token is undef if code was received without scopes.
    Need "code" or "refresh\_token" in arguments. 
        # return hash with access and refresh tokens by auth code
        print Dumper $sso->get_token(code=>'tCaVozogf45ttk-Fb71DeEFcSYJXnCHjhGy');
lib/EveOnline/SSO.pm view on Meta::CPAN
    use EveOnline::SSO;
    my $sso = EveOnline::SSO->new(client_id => '03ed7324fe4f455', client_secret => 'bgHejXdYo0YJf9NnYs');
    
    # return url for open in browser
    print $sso->get_code();
    # or
    print $sso->get_code(state => 'some_ids_or_flags');
    # or
    print $sso->get_code(state => 'some_ids_or_flags', scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1');
    # return hash with access and refresh tokens by auth code
    print Dumper $sso->get_token(code=>'tCaVozogf45ttk-Fb71DeEFcSYJXnCHjhGy');
    # or hash with access and refresh tokens by refresh_token
    print Dumper $sso->get_token(refresh_token=>'berF1ZVu_bkt2ud1JzuqmjFkpafSkobqdso');
    
    # return hash with access and refresh tokens through listening light web-server
    print Dumper $sso->get_token_through_webserver(
                        scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1', 
                        state=> 'Awesome'
                    );
=head1 DESCRIPTION
EveOnline::SSO is a perl module for get auth in https://eveonline.com through Single Sign-On (OAuth) interface.
=cut
lib/EveOnline/SSO.pm view on Meta::CPAN
See available scopes on L<https://developers.eveonline.com/>
    # return url for open in browser
    print $sso->get_code();
    
    # or
    print $sso->get_code(state => 'some_ids_or_flags');
    
    # or
    print $sso->get_code(scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1');
=back
=cut
sub get_code {
    my ( $self, %params ) = @_;
    return $self->auth_url . 
            "?response_type=code&client_id=".$self->client_id . 
            "&redirect_uri=".uri_escape( $self->callback_url ) . 
        client_id     => '76df1cffb31d0289',
        client_secret => 'e3a28554de3c2afc',
    );
is( $sso->get_code(), 'https://login.eveonline.com/oauth/authorize/?response_type=code&client_id=76df1cffb31d0289&redirect_uri=http%3A%2F%2Flocalhost%3A10707%2F', 
    'get_code' );
is( $sso->get_code(state => 'a28554df'), 'https://login.eveonline.com/oauth/authorize/?response_type=code&client_id=76df1cffb31d0289&redirect_uri=http%3A%2F%2Flocalhost%3A10707%2F&state=a28554df', 
    'get_code with state' );
is( $sso->get_code(state => 'a28554df', scope=>'esi-calendar.respond_calendar_events.v1 esi-location.read_location.v1'), 'https://login.eveonline.com/oauth/authorize/?response_type=code&client_id=76df1cffb31d0289&redirect_uri=http%3A%2F%2Flocalhost%3...
    'get_code with state and scope' );
my $sso = EveOnline::SSO->new(
        client_id     => '76df1cffb31d0289',
        client_secret => 'e3a28554de3c2afc',
        callback_url  => 'http://eveonline.com:45500/',
    );
is( $sso->get_code(), 'https://login.eveonline.com/oauth/authorize/?response_type=code&client_id=76df1cffb31d0289&redirect_uri=http%3A%2F%2Feveonline.com%3A45500%2F', 
    'get_code with custom callback url' );
( run in 1.233 second using v1.01-cache-2.11-cpan-5dc5da66d9d )