[Tutor] Help : Response Headers Location

Mats Wichmann mats at wichmann.us
Thu Dec 19 15:17:37 EST 2019


On 12/17/19 4:55 PM, Motka Blank wrote:
> Hello all,
> I am testing implicit grant flow, directly call to
> example:
> oauthurl = https://xxx.com? response_type=token&response_uri=
> http://127.0.0.1:5000/&client_id=tester-grants
> 
> If I put above url in browser, it goes to login page and I put username,
> password and submit the form, next page ( redirect uri) showed up with
> access_token
> 
> http://127.0.0.1:5000/#access_token=abcdxyz
> 
> Question:
> How can I get this access_token from backend python code.?
> ( I cannot use front end code, just use backend).
> I have tried several stuff and I did not get success yet.
> (1) I tried selenium webdriver:
> 
>      driver = webdriver.PhantomJS(executable_path='/usr/local/bin/phantomjs'
> )
> driver.get(oauthurl)
> username_field = driver.find_element_by_name('pf.username')
> username_field.send_keys(username)
> password_field = driver.find_element_by_name('pf.pass')
> password_field.send_keys(password)
> 
> submit_button = driver.find_element_by_id('login-button')
> submit_button.submit()
> time.sleep(20)
> current_url = driver.current_url is showing oauthurl and it did not change.
> I want to get redirect_uri with #access_token. If I get url including
> access_token, I can split access_tikne from url.
> But now I could not get this redirect url and I am struck with this.
> Please help me what python library I should use or sample of code that can
> get redirect uri would be very helpful.
> When I got http://127.0.01:5000/#access_token=abcdxyz, in inspect, network -
> I saw the access_token as a part of response headers Location.
> Please share me if you have that kind of experience. I have been working on
> that for a week now.

your question doesn't make any sense.

obtaining an access token which can then be passed on to a service 
provider is essentially a client operation.  what do you mean by "how 
can I get this from backend python code"?




More information about the Tutor mailing list