Hi shopify team:
Whether the app development can be fully implemented using server-side code?
The interface for configuring the APP URL is as follows
public void handle() {
HttpServletRequest request = this.getRequest();
String shop = request.getParameter("shop");
log.info("shopify 商家店铺: {}", shop);
// 判断是否已经注册授权
UserToThirdPlatform userToThirdPlatform
= UserToThirdPlatform.dao.findByOpenId(shop, ThirdPlatformEnum.Shopify.getPlatformId());
if (userToThirdPlatform != null) {
renderSuccessHtml(request, shop);
return;
}
// 如果未授权,生成 OAuth 授权链接并重定向
String authUrl = String.format(
"https://%s/admin/oauth/authorize?client_id=%s&scope=%s&redirect_uri=%s",
shop, API_KEY, SCOPE, REDIRECT_URI
);
log.info("shopify 授权链接: {}", authUrl);
redirect(authUrl);
}
The following interfaces are configured with callback addresses
public void callback() {
HttpServletRequest request = this.getRequest();
String code = getPara("code");
String shop = getPara("shop");
log.info("shopify 商家店铺: {}, code: {}", shop, code);
// 判断是否已经注册授权
UserToThirdPlatform userToThirdPlatform
= UserToThirdPlatform.dao.findByOpenId(shop, ThirdPlatformEnum.Shopify.getPlatformId());
if (userToThirdPlatform != null) {
renderSuccessHtml(request, shop);
return;
}
// 获取令牌
String accessToken = ShopifyService.requestAccessToken(shop, code);
if (accessToken == null) {
renderHtml(ShopifyService.failPage());
output(ShopifyService.failPage(), ReturnCode.FAIL, "失败");
}
// 获取商家信息并注册用户
Users users = ShopifyService.getShopInfoToRegisterUser(shop, accessToken);
UserService.onRegisterSuccess(getIp(), RegisterMethodEnum.REGISTER_BY_CODE, users, null, 0);
renderSuccessHtml(request, shop);
}
But check does not authenticate with the session tokens!!!
Could you please help me figure out how to solve this problem?