简体   繁体   English

如何阻止重定向 URL 被 Shopify CLI 擦除?

[英]How to stop redirect URL from being wiped by Shopify CLI?

I'm building a Shopify app and everytime I restart my server, the Oauth callback URL that I whitelisted gets removed in Shopify's partner dashboard.我正在构建一个 Shopify 应用程序,每次我重新启动服务器时,我列入白名单的 Oauth 回调 URL 都会在 Shopify 的合作伙伴仪表板中被删除。

Out of the box, Shopify comes with 3 Oauth URLs: Shopify 开箱即用,附带 3 个 Oauth URL:

https://6d57-64-183-178-66.ngrok.io/auth/callback
https://6d57-64-183-178-66.ngrok.io/auth/shopify/callback
https://6d57-64-183-178-66.ngrok.io/api/auth/callback

I needed to add a fourth for my use case:我需要为我的用例添加第四个:

https://6d57-64-183-178-66.ngrok.io/api/auth/callback/offline

On server restart, the Ngrok URL gets updated which is convenient, however, my URL gets deleted which is not convenient.在服务器重新启动时,Ngrok URL 会更新,这很方便,但是我的 URL 会被删除,这很不方便。

So for example, the above example would become the below example on server restart:因此,例如,上面的示例将在服务器重新启动时变为以下示例:

https://new-URL.ngrok.io/auth/callback
https://new-URL.ngrok.io/auth/shopify/callback
https://new-URL.ngrok.io/api/auth/callback

I used the Shopify CLI to scaffold this project and have been looking through the codebase to find where the whitelisted urls get updated.我使用 Shopify CLI 搭建了这个项目,并一直在查看代码库以查找白名单 url 的更新位置。 However, I have not been able to track down where this is occuring.但是,我无法追踪发生这种情况的位置。

Any insights into how I can stop my whitelisted URL from being deleted every server reset?关于如何阻止我的白名单 URL 在每次服务器重置时被删除的任何见解?

在此处输入图像描述

If I understand you run your application with如果我理解你运行你的应用程序

shopify app serve

Instead, what you can do is run相反,您可以做的是运行

shopify app tunnel start This will just create the tunnel and set the whitelists. shopify app tunnel start这将只创建隧道并设置白名单。

Then to run your app you can run然后运行你的应用程序,你可以运行

npm run serve (or npm run dev ) npm run serve (或npm run dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM