Skip to content

Instantly share code, notes, and snippets.

@slinkp
Created November 10, 2011 21:14
Show Gist options
  • Select an option

  • Save slinkp/1356251 to your computer and use it in GitHub Desktop.

Select an option

Save slinkp/1356251 to your computer and use it in GitHub Desktop.
Hack to avoid showing a confirmation form with django-oauth-plus
def oauth_authorize_without_confirmation(request, request_token, callback_url, params):
"""
This version uses some hackery to pretend the user has confirmed.
"""
params = request.GET.copy()
params['authorize_access'] = True
# request.POST claims to be immutable, but of course there's a way.
# Presumably I could just look up the HTTPRequest constructor...
request._set_post(params)
request.method = 'POST'
from oauth_provider.views import user_authorization
return user_authorization(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment