本文整理汇总了Python中socialregistration.utils.OAuthClient类的典型用法代码示例。如果您正苦于以下问题:Python OAuthClient类的具体用法?Python OAuthClient怎么用?Python OAuthClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OAuthClient类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: oauth_callback
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))
开发者ID:whatsthehubbub,项目名称:playpilots,代码行数:32,代码来源:views.py
示例2: oauth_callback
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))
开发者ID:imrehg,项目名称:django-socialregistration,代码行数:29,代码来源:views.py
示例3: oauth_callback
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))
开发者ID:jorgebastida,项目名称:django-socialregistration,代码行数:34,代码来源:views.py
示例4: oauth_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()
开发者ID:jorgebastida,项目名称:django-socialregistration,代码行数:25,代码来源:views.py
示例5: oauth_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()
开发者ID:imrehg,项目名称:django-socialregistration,代码行数:12,代码来源:views.py
注:本文中的socialregistration.utils.OAuthClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论