Hello, I was trying to access our authroization server scope and have modified the codes accordingly but i am getting below error and i will need help in understanding where i am missing the value.

Can't call method "store" on unblessed reference

My below subroutine that i am trying to run through Dancer2 app . Pleas let me know if there is any clue

sub access_to_protected_resource { my $your_app = shift; my ($args) = @_; my $dev = $args->{OKTAUsersList}; my $email = $args->{Email}; my $date = strftime '%Y-%m-%d-%H-%M-%S', localtime; my @responsetext; my @responsetextall; my $strExcelFilename1; my $linkheader; my $pagecount1 = "limit=200"; my $r = 1; my @apiurlapplog2 = $baseurl2 ."/api/v1/users?" . $pagecount1; $strExcelFilename1 = "C:/PERL/" . "Profile-User-Details" . $date . ".x +lsx"; my $access_token = $your_app->store->get("access_token"); my $expires_at = $your_app->store->get("expires_at"); my $refresh_token = $your_app->store->get("refresh_token"); unless ($access_token) { $your_app->start_authorize(); return; } if ($expires_at < time()) { $your_app->refresh_access_token(); return; } # my $req = HTTP::Request->new( ('GET', "$_[0]")); my $req = HTTP::Request->new( GET => q{https://dev.preview.com/api +/v1/users?limit=200}); #$req->header( Authorization => sprintf(q{Bearer}, $access_token) +); $req->header( Authorization => sprintf(q{OAuth %s}, $access_to +ken) ); my $agent = LWP::UserAgent->new; my $res = $agent->request($req); print "Response:$res\n"; }

I have used set below Builder configuration in order to integrate my local app with authrozation server so that the USR https://testchandan.com will redirect to our authrozation server for logging in but its throwing errors. Please check my builder configuration.

#!/usr/bin/env perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; use Plack::Middleware; # use this block if you don't need middleware, and only have a single +target Dancer app to run here use webapp; use Plack::Builder; use Authen::Simple::ActiveDirectory; use OIDC::Lite::Client::WebServer; use Log::Log4perl; my $client1 = OIDC::Lite::Client::WebServer->new( id => q{xxxxxxxxxxxx}, secret => q{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} +, authorize_uri => q{https://dev.preview.com/oauth2/v1/authorize} +, access_token_uri => q{https://dev.preview.com/oauth2/v1/token}, ); sub start_authorize { my $your_app = shift; my $redirect_url = $client1->uri_to_redirect( redirect_uri => q{https://testchandan.com:5001/callback}, scope => q{openid}, ); } builder { enable "Plack::Middleware" , start_authorize, webapp->to_app; };

is this possible for you to let me know the issue , I am getting. Please let me know if i am missing . This is the first time i am configuraing OIDC with my app

Can't locate object method "call" via package "Plack::Middleware" at C +:/Strawberry/perl/site/lib/Plack/Component.pm line 50, <DATA> line 75 +5. at C:\Strawberry\perl\site\lib\Plack\Component.pm line 50 in Plack::Component::__ANON__ at C:\Strawberry\perl\site\lib\Plack\Com +ponent.pm line 50 47: sub to_app { 48: my $self = shift; 49: $self->prepare_app; 50: return sub { $self->call(@_) }; 51: } 52: 53: Show function arguments in Plack::Middleware::Lint::call at C:\Strawberry\perl\site\lib\Plack\ +Middleware\Lint.pm line 24 21: my $env = shift; 22: 23: $self->validate_env($env); 24: my $res = $self->app->($env); 25: return $self->validate_res($res); 26: } 27: Show function arguments in Plack::Middleware::StackTrace::try {...} at C:\Strawberry\perl\site +\lib\Plack\Component.pm line 50 47: sub to_app { 48: my $self = shift; 49: $self->prepare_app; 50: return sub { $self->call(@_) }; 51: } 52: 53: in (eval) at C:\Strawberry\perl\vendor\lib\Try\Tiny.pm line 100 97: if ( $wantarray ) { 98: @ret = $try->(); 99: } elsif ( defined $wantarray ) { 100: $ret[0] = $try->(); 101: } else { 102: $try->(); 103: }; in Plack::Middleware::StackTrace::call at C:\Strawberry\perl\vendor\li +b\Try\Tiny.pm line 93 90: 91: # failed will be true if the eval dies, because 1 will not be + returned 92: # from the eval body 93: my $failed = not eval { 94: $@ = $prev_error; 95: 96: # evaluate the try block in the correct context Show function arguments in Plack::Component::__ANON__ at C:\Strawberry\perl\site\lib\Plack\Com +ponent.pm line 50 47: sub to_app { 48: my $self = shift; 49: $self->prepare_app; 50: return sub { $self->call(@_) }; 51: } 52: 53: Show function arguments in Plack::Middleware::AccessLog::call at C:\Strawberry\perl\site\lib\P +lack\Middleware\AccessLog.pm line 27 24: my $self = shift; 25: my($env) = @_; 26: 27: my $res = $self->app->($env); 28: 29: if ( ref($res) && ref($res) eq 'ARRAY' ) { 30: my $content_length = Plack::Util::content_length($res-> +[2]); Show function arguments in Plack::Component::__ANON__ at C:\Strawberry\perl\site\lib\Plack\Com +ponent.pm line 50 47: sub to_app { 48: my $self = shift; 49: $self->prepare_app; 50: return sub { $self->call(@_) }; 51: } 52: 53: Show function arguments in Plack::Middleware::ContentLength::call at C:\Strawberry\perl\site\l +ib\Plack\Middleware\ContentLength.pm line 10 7: 8: sub call { 9: my $self = shift; 10: my $res = $self->app->(@_); 11: 12: return $self->response_cb($res, sub { 13: my $res = shift; Show function arguments in Plack::Component::__ANON__ at C:\Strawberry\perl\site\lib\Plack\Com +ponent.pm line 50 47: sub to_app { 48: my $self = shift; 49: $self->prepare_app; 50: return sub { $self->call(@_) }; 51: } 52: 53: Show function arguments in (eval) at C:\Strawberry\perl\site\lib\Plack\Util.pm line 145 142: sub run_app($$) { 143: my($app, $env) = @_; 144: 145: return eval { $app->($env) } || do { 146: my $body = "Internal Server Error"; 147: $env->{'psgi.errors'}->print($@); 148: [ 500, [ 'Content-Type' => 'text/plain', 'Content-Lengt +h' => length($body) ], [ $body ] ]; in Plack::Util::run_app at C:\Strawberry\perl\site\lib\Plack\Util.pm l +ine 145 142: sub run_app($$) { 143: my($app, $env) = @_; 144: 145: return eval { $app->($env) } || do { 146: my $body = "Internal Server Error"; 147: $env->{'psgi.errors'}->print($@); 148: [ 500, [ 'Content-Type' => 'text/plain', 'Content-Lengt +h' => length($body) ], [ $body ] ]; Show function arguments in HTTP::Server::PSGI::handle_connection at C:\Strawberry\perl\site\li +b\HTTP\Server\PSGI.pm line 182 179: $env->{'psgi.input'} = $input; 180: } 181: 182: $res = Plack::Util::run_app $app, $env; 183: last; 184: } 185: if ($reqlen == -2) { Show function arguments in HTTP::Server::PSGI::accept_loop at C:\Strawberry\perl\site\lib\HTTP +\Server\PSGI.pm line 141 138: 'psgix.io' => $conn, 139: }; 140: 141: $self->handle_connection($env, $conn, $app); 142: $conn->close; 143: last if $env->{'psgix.harakiri.commit'}; 144: } Show function arguments in HTTP::Server::PSGI::run at C:\Strawberry\perl\site\lib\HTTP\Server\ +PSGI.pm line 63 60: sub run { 61: my($self, $app) = @_; 62: $self->setup_listener(); 63: $self->accept_loop($app); 64: } 65: 66: sub prepare_socket_class { Show function arguments in Plack::Handler::HTTP::Server::PSGI::run at C:\Strawberry\perl\site\ +lib\Plack\Handler\HTTP\Server\PSGI.pm line 14 11: 12: sub run { 13: my($self, $app) = @_; 14: $self->_server->run($app); 15: } 16: 17: sub _server { Show function arguments in Plack::Loader::run at C:\Strawberry\perl\site\lib\Plack\Loader.pm l +ine 84 81: 82: sub run { 83: my($self, $server, $builder) = @_; 84: $server->run($self->{app}); 85: } 86: 87: 1; Show function arguments in Plack::Runner::run at C:\Strawberry\perl\site\lib\Plack\Runner.pm l +ine 279 276: $loader->preload_app($app); 277: 278: my $server = $self->load_server($loader); 279: $loader->run($server); 280: } 281: 282: 1; Show function arguments at C:\Strawberry\perl\site\bin\plackup line 7 4: 5: my $runner = Plack::Runner->new; 6: $runner->parse_options(@ARGV); 7: $runner->run; 8: 9: __END__ 10:

In reply to Re^2: Need help in implementing OIDC::Lite::Webserver by chandantul
in thread Need help in implementing OIDC::Lite::Webserver by chandantul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.