Sure, Can you please let me know if this is the same app.psgi or the configuration will be different? My main goal is to capture the query string parameter "code" in order to get the value and utlize the same to get the access_token from our OKTA authorization server. I am trying to code sub function in my OP.pm, I was wondering i could utilize the HTTP request in order to collect the query string parameter code in same session and it won't ask for authentication.

sub result4 { my ($args) = @_; my $oktadev = $args->{OKTAUsersList}; my $email = $args->{Email}; my $ua = LWP::UserAgent->new(); $ua->proxy([ 'http' ], 'http://proxy.myorg.com:8080'); my $uri = URI->new('https://dev.oktapreview.com/oauth2/v1/authorize'); $uri->query_form(client_id => 'xxxxxxxxxxxxxxxxxx',response_type=>' +code', scope=>'openid okta.users.read',redirect_uri=>'https://testcha +ndan.com:5001',state=>'1234', nonce=>'UBGW'); my $response1 = $ua->get($uri); my $responsecode = $response1->code() ; my $responsecontent = $response1->content(); print $response1->headers_as_string if $response1->is_success; print "$responsecode\n"; print "$responsecontent\n"; unless($response1->is_success(),$response1->code) + { die($response1->code, "\n", $response1->content, "\n"); } }

Its redirecting again to authorization page as per the content but i was wondering this will get me the authrization code as its implemented on to the same app and i was using the same browser session without further asking the password.. Please let me know what should be my approch to collect query string parameter code from browser headers in order to get the access_token from Authorization server? Please let me know if any more details are needed

My webapp.pm

package webapp; use Dancer2; use Op; our $VERSION = '0.1'; get '/' => sub { #&client1; template 'query2' => { 'title' => 'webapp' }; }; post '/' => sub { my $r2 = Op::result4({OKTAUsersList => param('OKTA-Users-List'), Email => param('Email')}); template result4 => { title => 'webapp', result4 => $r2 } }; true;

In reply to Re^7: Need to resolve the API call query by chandantul
in thread Need to resolve the API call query 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.