def oauth_callback(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, template='socialregistration/oauthcallback.html', extra_context=dict(), parameters=None): """ View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider """ client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) extra_context.update(dict(oauth_client=client)) if not client.is_valid(): # Here we get when the oauth client is not valid logging.error('client is invalid') logging.info('parameters present: %s', str(parameters)) try: logging.error('request token %s', client._get_rt_from_session()) logging.error('access token %s', client._get_access_token()) except: pass for error in client.errors: logging.error('errors in client: %s', str(error)) return render_to_response( template, extra_context, context_instance=RequestContext(request) ) # We're redirecting to the setup view for this oauth service return HttpResponseRedirect(reverse(client.callback_url))
def oauth_callback(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, template='socialregistration/oauthcallback.html', extra_context=dict(), parameters=None): """ View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider """ client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) extra_context.update(dict(oauth_client=client)) if not client.is_valid(): return render_to_response(template, extra_context, context_instance=RequestContext(request)) # We're redirecting to the setup view for this oauth service return HttpResponseRedirect(reverse(client.callback_url))
def oauth_callback(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, template='socialregistration/oauthcallback.html', extra_context=dict(), parameters=None): """ View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider """ client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) # the user has denied us - throw that in messages to be displayed and send them back where they came from if 'denied' in request.GET: messages.info(request, "You must authorize the application in order to link your account.") try: redirect = request.META['HTTP_REFERER'] # send them where they came from except KeyError: redirect = _get_next(request) # and fall back to what the view would use otherwise return HttpResponseRedirect(redirect) extra_context.update(dict(oauth_client=client)) if not client.is_valid(): return render_to_response( template, extra_context, context_instance=RequestContext(request) ) # We're redirecting to the setup view for this oauth service return HttpResponseRedirect(reverse(client.callback_url))
def oauth_callback( request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, template="socialregistration/oauthcallback.html", extra_context=dict(), parameters=None, ): """ View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider """ client = OAuthClient( request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters, ) extra_context.update(dict(oauth_client=client)) if not client.is_valid(): return render_to_response(template, extra_context, context_instance=RequestContext(request)) # We're redirecting to the setup view for this oauth service return HttpResponseRedirect(reverse(client.callback_url))
def oauth_redirect( request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, parameters=None, ): """ View to handle the OAuth based authentication redirect to the service provider """ request.session["next"] = _get_next(request) client = OAuthClient( request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters, ) return client.get_redirect()
def oauth_redirect(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, parameters=None): """ View to handle the OAuth based authentication redirect to the service provider """ request.session['next'] = _get_next(request) client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) return client.get_redirect()
def oauth_redirect(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, parameters=None): """ View to handle the OAuth based authentication redirect to the service provider """ request.session['socialregistration_connect_object'] = get_object(request.GET) request.session['next'] = _get_next(request) client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) return client.get_redirect()
def oauth_callback(request, consumer_key=None, secret_key=None, request_token_url=None, access_token_url=None, authorization_url=None, callback_url=None, template='socialregistration/oauthcallback.html', extra_context=dict(), parameters=None): """ View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider """ client = OAuthClient(request, consumer_key, secret_key, request_token_url, access_token_url, authorization_url, callback_url, parameters) # the user has denied us - throw that in messages to be displayed and send them back where they came from if 'denied' in request.GET: messages.info( request, "You must authorize the application in order to link your account." ) try: redirect = request.META[ 'HTTP_REFERER'] # send them where they came from except KeyError: redirect = _get_next( request) # and fall back to what the view would use otherwise return HttpResponseRedirect(redirect) extra_context.update(dict(oauth_client=client)) if not client.is_valid(): return render_to_response(template, extra_context, context_instance=RequestContext(request)) # We're redirecting to the setup view for this oauth service return HttpResponseRedirect(reverse(client.callback_url))