MLH / mlh-hackathon-flask-starter

Hackathon starter project for Flask applications
MIT License
731 stars 286 forks source link

Bad request when getting access_token #14

Open regisin opened 5 years ago

regisin commented 5 years ago

I followed the steps and had the webapp running locally. When I login with my github account, and the callback url is called, it returns a "Bad request" error.

This is what I see in the console:

$ flask run
 * Serving Flask app "app/app.py" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 237-487-250
127.0.0.1 - - [03/May/2019 04:27:06] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2019 04:27:06] "GET /static/css/style.css HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2019 04:27:06] "GET /static/css/colors.css HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2019 04:27:06] "GET /static/img/logo.png HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2019 04:27:07] "GET /static/favicon.ico HTTP/1.1" 200 -
127.0.0.1 - - [03/May/2019 04:27:44] "GET /auth/login/github HTTP/1.1" 302 -
127.0.0.1 - - [03/May/2019 04:27:55] code 400, message Bad request syntax ('\x16\x03\x01\x02\x00\x01\x00\x01ü\x03\x03ä\x95IZa\x1ee"ô\x0e2\x0fêB\x98KÀ\x8cp^4.k\x88ζÍ\x1eÃï$L ÅD¤D\x05\x10\x9a>-iñ¶àNN×\x13Q²íÆ\x8dÝL*lÆ*;%\x04\x8b\x00"úú\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x00')
127.0.0.1 - - [03/May/2019 04:27:55] "üä•IZae"ô2êB˜KÀŒp^4.kˆÎ¶ÍÃï$L ÅD¤Dš>-iñ¶àNN×Q²íƍÝL*lÆ*;%‹"úúÀ+À/À,À0̨̩ÀÀœ/5" HTTPStatus.BAD_REQUEST -
127.0.0.1 - - [03/May/2019 04:27:55] code 400, message Bad request syntax ('\x16\x03\x01\x02\x00\x01\x00\x01ü\x03\x03©i¦ë*\x9cCÃ\x99Ûº"¡8\tiw+*Ü6Ó,\x8a¦À=n\x98ÜHà £é\tyÆK\x92§+Q\x90åÄ\x95>\x01\x1a\x7fÊFÇ!ý\x93+,ç\x87¤\x16Që\x00"::\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x00')
127.0.0.1 - - [03/May/2019 04:27:55] "ü©i¦ë*œCÙۺ"¡8   iw+*Ü6Ó,Š¦À=n˜ÜHà £é    yÆK’§+Qåĕ>ÊFÇ!ý“+,燤Që"::À+À/À,À0̨̩ÀÀœ/5" HTTPStatus.BAD_REQUEST -
127.0.0.1 - - [03/May/2019 04:27:55] code 400, message Bad request version ('\x8a\x8aÀ+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x00')
127.0.0.1 - - [03/May/2019 04:27:55] "ÿf»N•kÿÑP´[  rÍãø¢û@HfƒõbWPNN°ŠŠÀ+À/À,À0̨̩ÀÀœ/5" HTTPStatus.BAD_REQUEST 

I couldn't find the documentation for the github api (https://github.com/login/oauth/access_token) that the get_token() method calls to check if the params were ok.

I'm not sure what other information is needed to debug/solve this issue.

FrancisBehnen commented 5 years ago

Are you sure your database is working? How did you set it up? I got something similar when I pointed the website to a database that already contained a user table.

shafiemukhre commented 5 years ago

Setup the callback link with http request. http://localhost:5000/auth/callback/github instead of https://localhost:5000/auth/callback/github