Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Token and auth-token
#1
Hey all.
I have problem which i dont quite understand how to go about from here.
I use request library to sign-in to website and I believe im doing that right. I make a post request to /sign-in page and response to the POST request is following

b'{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjEuNTYzOTkyOTMzRTksImFwaV90b2tlbiI6ImFmYmRmZGRmMmVmMDRjYTE4NmUxZmQ2ZWU5MWM3MmE4IiwiZW1haWwiOiJwY2FicmVyb0BnbWFpbC5jb20iLCJ1dWlkIjoiNDdkYjEzYTMtY2ZkYy00NmRmLWE3OTgtYmUzMjI1MDcxYThiIn0.VQdYwBWlEkqewFQd72K2BA4Zd9aP6mQ_42uYsDgx9Ao","auth_token":"CNxnJqAuUPeeH12TB3BEaE1lU1LR4+8gkaQQjDGRoxkJ3ApQrgNXGAMwu5t8TvevBnjHp31XLNQvtonJEaJUtQ=="}'
I basically expecting some html back if the login was successful. But instead I get these token. What do I do with these token from here. My code looks like this.

with requests.Session() as s:
    url = "https://app.nutmeg.com/auth/users/sign_in"
    url2 = "https://app.nutmeg.com/client"
    r = s.get(url, headers=headers)
    soup = BeautifulSoup(r.content, 'html5lib')
    login_data['authenticity_token'] = soup.find('input', attrs={'name': 'authenticity_token'})['value']
    r1 = s.post(url, data=login_data, headers=headers)
    r2 = s.get(url2, headers=headers)
    print(r2.content)
any help would be much appreciated

Thanks

Just to add more information. Im trying to login to nutmeg account.
https://app.nutmeg.com/auth/users/sign_in
Quote
#2
Probably the site you are parsing is a kind of SPA application. This kind of sites don't return HTML as a response, they work over AJAX and receive only JSON.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Google calendar pthon flask auth Kireta 0 405 Sep-16-2019, 04:50 PM
Last Post: Kireta
  Getting csrf token to log in spartanvfl 4 14,219 Aug-08-2019, 08:19 PM
Last Post: NSearch
  Flask tutorial errors in jinja, auth undefined Ecniv 2 484 May-03-2019, 02:04 PM
Last Post: Ecniv
  Problem enabling http auth in a route nikos 2 636 Mar-02-2019, 01:13 PM
Last Post: nikos
  Python /Flask Login with LDAP Auth pythonnubie 4 4,393 Apr-16-2018, 03:14 PM
Last Post: nilamo
  Uninitialized ASN.1 value in Flask LDAP3 Auth blueprint zoidberg 1 1,866 Nov-15-2017, 12:29 PM
Last Post: zoidberg

Forum Jump:


Users browsing this thread: 1 Guest(s)