bbangert / velruse

Simplifying third-party authentication for web applications.
http://packages.python.org/velruse/index.html
MIT License
252 stars 86 forks source link

Fix Live provider (use POST instead of GET to avoid stacktrace). #155

Open antoineleclair opened 8 years ago

antoineleclair commented 8 years ago

I was getting this stack trace when using Microsoft Live:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pyramid_debugtoolbar/toolbar.py", line 215, in toolbar_tween
    response = _handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid_debugtoolbar/panels/performance.py", line 57, in resource_timer_handler
    result = handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/tweens.py", line 51, in excview_tween
    request_iface=request_iface.combined
  File "/usr/local/lib/python3.5/site-packages/pyramid/view.py", line 547, in _call_view
    response = view_callable(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/viewderivers.py", line 512, in csrf_view
    return view(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/viewderivers.py", line 413, in viewresult_to_response
    result = view(context, request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/tweens.py", line 22, in excview_tween
    response = handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 101, in tm_tween
    reraise(*exc_info)
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/compat.py", line 15, in reraise
    raise value
  File "/usr/local/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 83, in tm_tween
    response = handler(request)
  File "/usr/local/lib/python3.5/site-packages/pyramid/router.py", line 127, in handle_request
    root = root_factory(request)
  File "/usr/local/lib/python3.5/site-packages/velruse/providers/live.py", line 107, in callback
    r.status_code, r.content))
velruse.exceptions.ThirdPartyFailure: Status 400: b'{"error":"invalid_request","error_description":"The provided request must be sent using the HTTP \'POST\' method."}'

Changing that request to a POST fixed the issue.