Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-24 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found