我正在写 Shopify管理员API 。我正在尝试通过Spring Boot REST模板存储新产品。显示错误。我读了一篇文章。也就是说,“我想更改私人应用程序中的读写访问权限”。我将其更改为读写模式。但是读取模式工作正常。当我尝试添加新产品时。我得到了错误。
请求:
方法: POST
{
"product": {
"title": "Burton Custom Freestyle 151",
"body_html": "<strong>Good snowboard!</strong>",
"vendor": "Burton",
"product_type": "Snowboard",
"published": false
}
}
响应:
<html>
<body>
<noscript>
<a href="https://app.shopify.com/services/login/identity?destination_uuid=9b4d5083-3355-4828-93dd-f077e9531664&return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3DFestivya%26state%3DRFvJCqXh64NCu1FGcxpD8vzVFSJrDVuDkTuz9exEjDjFgjbjXD5X8KFDXQu4LKOjOahYF0Bid_Dy2ejkD8yUu4mIHpKUT2aT0fpiAIhROlhT9NxAU3QkzBMeb715ANSGOon1duh3pqkRlZD0URqr3B8YUzcTC1lA8BpN5Thjg--LIpOKpJHbtE6FlbBQ-yHZ8dq3RDJilr9pCo42I3owe-wOj3Z7gvQ-IOZ_h_xNtKY%253D&ui_locales=en&upgradeable=true&ux=shop">Continue</a>
</noscript>
<script type="text/javascript">
window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destination_uuid=9b4d5083-3355-4828-93dd-f077e9531664\u0026return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3DFestivya%26state%3DRFvJCqXh64NCu1FGcxpD8vzVFSJrDVuDkTuz9exEjDjFgjbjXD5X8KFDXQu4LKOjOahYF0Bid_Dy2ejkD8yUu4mIHpKUT2aT0fpiAIhROlhT9NxAU3QkzBMeb715ANSGOon1duh3pqkRlZD0URqr3B8YUzcTC1lA8BpN5Thjg--LIpOKpJHbtE6FlbBQ-yHZ8dq3RDJilr9pCo42I3owe-wOj3Z7gvQ-IOZ_h_xNtKY%253D\u0026ui_locales=en\u0026upgradeable=true\u0026ux=shop";
</script>
</body>
</html>
答案 0 :(得分:0)
这不是API权限问题。在这种情况下,您将收到相关的错误消息。此问题是由于发送带有POST请求的Cookie所致。根据{{3}}:
Shopify阻止具有cookie的HTTP Basic Auth POST请求, 这可能会导致POST调用失败。如果您的POST呼叫失败,那么您 应该尝试清除您的Cookie。
只需禁用cookie。为此,我认为您正在寻找Shopify documentation。
无状态: Spring Security永远不会创建HttpSession,也永远不会使用它来获取SecurityContext
有关更多信息,请查看此Session Creation Policy。
答案 1 :(得分:0)
从#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser(description='Read head of file.')
parser.add_argument('file', help='Textfile to read')
parser.add_argument('--N', type=int, default=10, help='Number of lines to read')
args = parser.parse_args()
with open(args.file) as myfile:
head = myfile.readlines()[0:args.N]
print(head)
继承的Web安全配置文件中,例如:
WebSecurityConfigurerAdapter
在方法@Configuration
@EnableWebSecurity
@EnableConfigurationProperties
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {}
中将会话管理定义为 protected void configure(HttpSecurity http) throws Exception
,如下所示:
STATELESS