Bluesky
view release on metacpan or search on metacpan
lib/Bluesky.pm view on Meta::CPAN
my $state = $c->param('state');
if ( $code && $state ) {
say 'Exchanging code for tokens...';
try {
$self->oauth_callback( $code, $state );
$on_success->($self);
$c->render( text => '<h1>Success!</h1><p>You can close this window and return to the terminal.</p>' );
# Stop loop after response
require Mojo::IOLoop;
Mojo::IOLoop->timer( 1 => sub { exit 0 } );
}
catch ($e) {
$c->render( text => 'OAuth Callback failed: ' . $e, status => 500 );
die $e;
}
}
else {
$c->render( text => 'Error: Missing code or state.', status => 400 );
}
}
( run in 2.579 seconds using v1.01-cache-2.11-cpan-bbcb1afb8fc )