osiset / laravel -shopify- webhook中的用户身份验证
我是Shopify应用程序开发的新手。我想在Laravel作业中进行Admin API调用,这是触发Webhook通知时。
以下是应用程序流的详细信息:
- 客户在收到订单创建
- Webhook通知时触发商户订单中创建
- 订单- 我想通过类型使用费用拨打计费API。
我遇到的主要问题是如何在Webhook中对用户进行身份验证。我知道使用$ shop = auth :: user()在shopify管理中身份验证用户; $ shopapi = $ shop-> api() - > rest('get','/admin/shop.json'prion.jesh'prion.json'proh但是这个献祭在Laravel工作处理方法中起作用。
我当时想保存生成的访问权限“ $ shop = auth :: user(); $ shopapi = $ shop-> api()”。但是我似乎找不到访问access_token并将其保存到数据库中的方法,以便我可以使用相同的access_token来制作计费API请求。 这是最好的方法。 Access_Token有任何有效期吗?
如果也有任何最佳方法,请建议您。
谢谢
I am new to shopify app development. I want to make ADMIN API call in Laravel Jobs that is when webhook notification is triggered.
Here is the details of app flow:
- Customer creates order in merchant shop
- Order-create webhook is triggered
- When order-create webhook notification is received I want to call billing api with type usage charge.
The main problem I have is how to authenticate user in webhook. I know to authenticate the user within Shopify admin using $shop = Auth::user(); $shopApi = $shop->api()->rest('GET', '/admin/shop.json')['body']['shop'];. But this donot work in Laravel Job handle method.
I was thinking to save the access-token that is generated " $shop = Auth::user(); $shopApi = $shop->api()". But I can't seem to find the way to access the access_token and save it into the database so that I can use same access_token to make billing api requests.
Is this approach the best approach. Does access_token has any expiry date?
Please recommend if there is any best approach as well.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您想从作业类访问用户。因此,在每个工作类中的此软件包中,您可以轻松找到Shopdomain
$ this-> Shopdomain
。因此,只需从各自的商店域中获取用户的数据:如果有商店:
我希望这对您有所帮助。如果有任何问题,请在此处发表评论。
I am assuming that you want to access user from job class. So in this package in every job class, you can easily found the shopDomain
$this->shopDomain
. So then just get the data of the user from that respective shopDomain:If there is a shop then:
I hope this will help you. If there is any issue, please comment here.