jakajancar / DropboxUploader

MIT License
203 stars 114 forks source link

Error: [DropboxUploader] #268699650 Cannot extract login CSRF token. #63

Open lucabocchiardi89 opened 8 years ago

lucabocchiardi89 commented 8 years ago

I get this message of error when I try to login and upload a file.

private function extractTokenFromLoginForm($html) {
    $pattern = '~
        (?J)
        # HEADER cookie: set-cookie: js_csrf=JDAyWg55Y_xItHN_LB8KJ3d5; Domain=
        set-cookie:\ js_csrf=(?P<token>[A-Za-z0-9_-]+);\ Domain=

        # HTML: <input type="hidden" name="t" value="UJygzfv9DLLCS-is7cLwgG7z" />
        |<input\ type="hidden"\ name="t"\ value="(?P<token>[A-Za-z0-9_-]+)"\ />

        # JSON: , "TOKEN": "mytoken",
        |,\ "TOKEN":\ "(?P<token>[A-Za-z0-9_-]+)",\
    ~x';
    if (!preg_match($pattern, $html, $matches)) {
        throw new Exception('Cannot extract login CSRF token.', self::CODE_SCRAPING_LOGIN);
    }

    return $matches['token'];
}

I put my token on "TOKEN": "...." but it's not working, why? thank you

PROSTYLEPC commented 8 years ago

same issue..

antonio-molina commented 8 years ago

same issue here. Is this still working?

tvdgreft commented 8 years ago

I have the same problem: Cannot extract login CSRF token. I use version 1.1.22 Is there a solution?

sylvainbx commented 8 years ago

Same issue here with v1.1.22

Here's the stacktrace:

exception 'Exception' with message 'Cannot extract login CSRF token.' in /home/www/DropboxUploader.php:280
[2016-03-14 21:57:02] Stack trace:
[2016-03-14 21:57:02] #0 /home/www/DropboxUploader.php(185): DropboxUploader->extractTokenFromLoginForm('HTTP/1.1 200 OK...')
[2016-03-14 21:57:02] #1 /home/www/DropboxUploader.php(122): DropboxUploader->login()
[2016-03-14 21:57:02] #2 /home/www/run_backup.php(45): DropboxUploader->upload('/home/www...')
[2016-03-14 21:57:02] #3 {main}
antonio-molina commented 8 years ago

For everyone that is having the same problem: I didn't fix the issue but I make it work using this other alternative: https://github.com/f4bsch/DropPHP

daniel-bonigi commented 8 years ago

I have the same problem with the latest version (1.1.22). Is there any plan for solving it or should we move to other alternative libraries? I have checked out Dropbox API and DropPHP but they weren't suitable for me though.. This has been really good until it broke.

emresaracoglu commented 8 years ago

same issue

BigManatee commented 7 years ago

Same issue, fixed it by replacing return $matches['token']; with return explode(";", explode("Set-Cookie: t=", $html)[1])[0]; and commenting out throw new Exception('Cannot extract login CSRF token.', self::CODE_SCRAPING_LOGIN); in dropboxUploader.php but now i'm facing a recaptcha issue

andre-koch commented 6 years ago

Any solution to this please?

bars38 commented 6 years ago

The same problem

testingCitytech commented 4 years ago

same problem