使用PHP的Shopify API,redirect_uri和应用程序url必须具有myshopify.com的匹配主机?(Shopify API using PHP, redirect_uri and app url must have matching hosts of myshopify.com?)
我试图使用由cmcdonaldca在https://github.com/cmcdonaldca/ohShop.php创建的php shopify api库和
我得到这个错误:
redirect_uri和应用程序url必须具有匹配的主机
在我输入[myshopname] .myshopify.com的商店名称并且该错误出现在具有此网址的页面上后,会出现这种情况:https:// [myshopname] .myshopify.com / admin / oauth / authorize?client_id = [myclientid ]范围=顾客&REDIRECT_URI = HTTP%3A%2F%2Flocalhost%2Ftest%2FshopifyAPITest2.php
我在本地做这个开发,所以我的主机是本地主机,这真的是问题吗? 我第一次尝试输入商店名称时,我到了shopify页面要求我登录,但后来当我再次尝试时,它给了我错误。 是否有一些最初设置会导致错误的会话变量? 它看起来不像是基于错误,但这就是行为所暗示的。
请帮我理解如何解决这个问题。 如果它确实意味着api脚本需要在myshopify.com([myshopname] .myshopify.com的主机)托管,那么我将如何在那里放置一个php脚本?
谢谢
I'm trying to use the php shopify api library created by cmcdonaldca at https://github.com/cmcdonaldca/ohShopify.php and
I am getting this error:
The redirect_uri and application url must have matching hosts
This occurs after I type in the shop name of [myshopname].myshopify.com and the error appears on a page with this url: https://[myshopname].myshopify.com/admin/oauth/authorize?client_id=[myclientid]&scope=Customer&redirect_uri=http%3A%2F%2Flocalhost%2Ftest%2FshopifyAPITest2.php
I'm doing this development locally so my host is localhost, is that really the issue? The first time I tried entering a shop name I got to the shopify page asking me to login, but then when I tried it again later it is giving me the error. Is there some session variable that was set initially that is causing the error? It doesn't look like it based on the error, but that's what the behavior suggests.
Please help me understand how to address this issue. If it really means the api script needs to be hosted at myshopify.com (the host for [myshopname].myshopify.com) how would I put a php script there?
Thank you
原文:https://stackoverflow.com/questions/13181880
最满意答案
解决了,我只使用原生SQL,addScalar方法和List of Object [],以及大的查询:
Session session = null; List<Object[]> catalogStores = new ArrayList(); try { session = this.sessionFactory.openSession(); catalogStores = session.createSQLQuery("select \n" + " t1.name as goodsName,\n" + " t3.name as companyName,\n" + " sum(t2.amount) as amountSum,\n" + " t3.price as priceOneGoods,\n" + " (t1.price * sum(t2.amount)) as summ \n" + "from\n" + " store_catalog t1\n" + " inner join\n" + " commission t2 ON (t1.id = t2.idGoodsStore)\n" + " inner join\n" + " company_catalog t3 ON (t3.id = t2.idGoodsCompany)\n " + " inner join\n" + " store t4 ON (t1.idStore = " + idStore + ")\n " + "group by t1.id") .addScalar("goodsName", new StringType()) .addScalar("companyName", new StringType()) .addScalar("amountSum", new IntegerType()) .addScalar("priceOneGoods", new DoubleType()) .addScalar("summ", new DoubleType()) .list(); } catch (Exception e) { e.printStackTrace(); } finally { if (session != null && session.isOpen()) session.close(); } return catalogStores;
在我的JSP节目中,如:
<c:forEach items="${statList1}" var="stat"> <tr class="editField"> <td> <c:out value="${stat[0]}" /> </td> <td> <c:out value="${stat[1]}" /> </td> <td> <c:out value="${stat[2]}" /> </td> <td> <c:out value="${stat[3]}" /> </td> <td> <c:out value="${stat[4]}" /> </td> </tr> </c:forEach>
控制器中的部件代码:
modelAndView.addObject("statList1", myService.myMethod());
Solved, I just use native SQL, addScalar method, and List of Object[], and big big query:
Session session = null; List<Object[]> catalogStores = new ArrayList(); try { session = this.sessionFactory.openSession(); catalogStores = session.createSQLQuery("select \n" + " t1.name as goodsName,\n" + " t3.name as companyName,\n" + " sum(t2.amount) as amountSum,\n" + " t3.price as priceOneGoods,\n" + " (t1.price * sum(t2.amount)) as summ \n" + "from\n" + " store_catalog t1\n" + " inner join\n" + " commission t2 ON (t1.id = t2.idGoodsStore)\n" + " inner join\n" + " company_catalog t3 ON (t3.id = t2.idGoodsCompany)\n " + " inner join\n" + " store t4 ON (t1.idStore = " + idStore + ")\n " + "group by t1.id") .addScalar("goodsName", new StringType()) .addScalar("companyName", new StringType()) .addScalar("amountSum", new IntegerType()) .addScalar("priceOneGoods", new DoubleType()) .addScalar("summ", new DoubleType()) .list(); } catch (Exception e) { e.printStackTrace(); } finally { if (session != null && session.isOpen()) session.close(); } return catalogStores;
And in my JSP show, as like as:
<c:forEach items="${statList1}" var="stat"> <tr class="editField"> <td> <c:out value="${stat[0]}" /> </td> <td> <c:out value="${stat[1]}" /> </td> <td> <c:out value="${stat[2]}" /> </td> <td> <c:out value="${stat[3]}" /> </td> <td> <c:out value="${stat[4]}" /> </td> </tr> </c:forEach>
Part code in controller:
modelAndView.addObject("statList1", myService.myMethod());
相关问答
更多-
在Hibernate中查询(Query in Hibernate)[2023-12-17]
这个 PermGen space 说:重启你的Tomcat。 您可能经常重新部署WAR。 这会导致PermGen空间用完。 I found the answer. The problem is here : @ManyToOne(fetch = FetchType.LAZY) private Activity parent; I jsut need to use FetchType.EAGER or remove it. -
如何在where子句上显示agregate?(how to show agregate on where clause ? or is there any other way to solve this)[2023-03-09]
select customer_id , name ,sum(total) from customer ,sales_detail d, Sales s where d.sales_id = s.sales_id and customer_id = s.customer_id having sum(total) > ( select sum(total) from customer , sales s, sales_detail d ... -
何时使用Hibernate?(When to use Hibernate?)[2023-12-12]
Hibernate适用于大多数具有面向对象模型的应用程序。 所以你可以问:什么时候面向对象的模型是合适的? 我会说,最大的优势是开发人员的生产力。 查询性能本身通常比手工编码查询更差,因为它无法针对每个特定情况进行优化。 休眠通过使用缓存来很好地补偿这一点。 只写(大部分)系统不能从缓存中获得太多优势,甚至可能会降低性能(应该避免使用缓存)。 这些类型的系统通常不需要面向对象的模型,他们只是将数据推送到数据库中。 Hibernate is suitable for most of the applicati ... -
如何在hibernate中使用agregate函数编写查询?(How to write query with agregate functions in hibernate?)[2023-06-24]
解决了,我只使用原生SQL,addScalar方法和List of Object [],以及大的查询: Session session = null; List -
如何在Hibernate Criteria Query中使用MySQL函数(How to use MySQL functions in Hibernate Criteria Query)[2023-01-15]
所以我终于找到了一个从这个链接的方式: stackoverflow.com/questions/2345419/ 我需要像这样使用Restrictions.sqlRestriction(): 条件标准= createCriteria(); criteria.add(Restrictions.sqlRestriction(“DATE_FORMAT({别名}。生日,'%m%d')=?”,birthDay,StringType.INSTANCE)); 这样可行 !! So I finally found out ... -
我已经阅读了很多东西,做了很多不同的方法,我认为没有办法一起为所有数据库写入和读取查询。 我停止使用hibernate并自己实现了一切 I have read so many things and done so many different ways, I think there is no way to do the write and read querys for all databases together. SAo I stopped using hibernate and implemente ...
-
使用agregate和条件查询而不加入(Bigquery标准sql)(Query with agregate and condition without join (Bigquery standard sql))[2023-06-28]
以下是BigQuery Standard SQL #standardSQL SELECT column1, MAX(IF(condition = 1, column2, '')) column2, SUM(value)sumOfValue FROM `project.dataset.table` GROUP BY column1 您可以使用以下问题中的示例来测试/播放它 #standardSQL WITH `project.dataset.table` AS ( SELECT 1 ... -
例如,您有两个模型: @Entity class Employee { @Id private Long id; @OneToOne private EmployeeLang employeeLang; ... } @Entity class EmployeeLang { @Id private Long id; private String langCode; @OneToOne private Employee employee; ... } 你应该在它们之 ...
-
那么,既然你不想让别人为你做所有的工作,并且你想使用子查询,你可以尝试以下方法: select col1, total_items from ( select col1, sum(col2) as total_items from part group by col1 ) where total_items < 20 and total_items > 0 order by total_items; 请注意,您将子查询视为“表”... 现在,使用HAVING子句: sel ...
-
经过一番研究后,可以使用公式注释完成: @Entity public class A { @Column(name ="a1") private int a1; @Column(name ="a2") private int a2; @Formula("myFunction(a1)") private int a3; ..... } 在标准中: Criteria cr = getInstanciaCriteria(A.class); cr.add(Restr ...