4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/shopify_cli/tasks/ensure_loopback_url.rb', line 4
def call(ctx)
@ctx = ctx
api_key = Project.current.env.api_key
result = ShopifyCLI::PartnersAPI.query(ctx, "get_app_urls", apiKey: api_key)
loopback = IdentityAuth::REDIRECT_HOST
app = result["data"]["app"]
urls = app["redirectUrlWhitelist"]
if urls.grep(/#{loopback}/).empty?
with_loopback = urls.push(loopback)
ShopifyCLI::PartnersAPI.query(@ctx, "update_dashboard_urls", input: {
redirectUrlWhitelist: with_loopback, apiKey: api_key
})
end
end
|