Open
Description
I'm implementing OAuth in a pretty large code-base, i've passed the OAuth2
object down from the controller into a service layer object, which ultimately should be making the call too get_token_p
however, the parameter passed to the ->then(...)
callback seems to ALWAYS be undef
, and at the speed of the error I'm almost 100% sure it doesn't make a call at all. I haven't had this issue with seemingly identical code that lives in the Mojolicious::Controller
,
Custom service level code
sub execute {
my $self = shift;
my $args = {
scope => $self->scope, # 'user email'
redirect_uri => $self->redirect_uri # 'http://localhost:3000/login/github'
};
return $self->oauth->get_token_p( github => $args )->then(
sub {
my $pr = shift;
use DDP;
p $pr;
p $self->oauth->providers;
return $pr->{access_token};
});
}
First print:
undef
Second print (redacted of course):
github {
authorize_url "https://github.com/login/oauth/authorize",
key "XXX" (dualvar: 6),
secret "XXX",
token_url "https://github.com/login/oauth/access_token"
},
Controller code
sub github {
my $self = shift;
Project::Service::OAuth2::Github->new(oauth => $self->oauth2)->execute->then(sub { ... });
}
Metadata
Metadata
Assignees
Labels
No labels