【发布时间】:2017-11-28 07:19:12
【问题描述】:
我正在学习 django 并尝试完成我的第一个 web 应用程序。
我正在使用 shopify api 和锅炉板 (starter code),但在身份验证的最后一步遇到问题。
具体来说,重定向 URL —— 它在不应该使用 HTTP:// 时使用了 HTTP://,我不知道如何更改它..
#in my view
def authenticate(request):
shop = request.GET.get('shop')
print('shop:', shop)
if shop:
scope = settings.SHOPIFY_API_SCOPE
redirect_uri = request.build_absolute_uri(reverse('shopify_app_finalize')) #try this with new store url?
print('redirect url', redirect_uri) # this equals http://myherokuapp.com/login/finalize/
permission_url = shopify.Session(shop.strip()).create_permission_url(scope, redirect_uri)
return redirect(permission_url)
return redirect(_return_address(request))
这是一个问题,因为我的应用使用嵌入式 Shopify SDK,这会导致在此请求时发生此错误
Refused to frame 'http://my.herokuapp.com/' because it violates the following Content Security Policy directive: "child-src 'self' https://* shopify-pos://*". Note that 'frame-src' was not explicitly set, so 'child-src' is used as a fallback.
如何更改 URL 以使用 HTTPS?
提前非常感谢您。如果我可以分享任何其他细节,请告诉我,但我的代码实际上与 starter code 相同。
【问题讨论】: