Updating App and callback URL from localhost to actual url is not working

Updating App and callback URL from localhost to actual url is not working

abhimanyubv
Shopify Partner
3 0 0

I have updated the app urls and callback url for my existing app. Before the url is localhost, but now I have hosted in in a cloud server and assigned a domain and updated this domain in the app url and callback url. But when i am trying to install app from app overview page, it is still redirecting to localhost only. How can i change this behavior?

 

https://abc.myshopify.com/admin/oauth/authorize?client_id=<clientid>&scope=<scopes>&redirect_uri=htt...

 

I have written my code in ruby and used shopify api  and shopify app gem

Replies 2 (2)

StoreWatchers
Trailblazer
205 30 39
Hello @abhimanyubv,
 

Greetings from the Store Watchers Support Team! Happy to help you today. 

 

To change this behavior you have to change the URL in the code as well.
 
For example, while getting the auth token or creating the charges you have to pass the redirect URL to Shopify API. Have you changed it? If not please change it is essential. 
 
Happy to assist 🙂

StoreWatchers - Automate testing for your Shopify store in seconds


If you find my reply helpful, please hit Like and Mark as Solution
Visit us: App Store | Website | FAQs
abhimanyubv
Shopify Partner
3 0 0

I am using shopify_app gem developed in Ruby. Below is the configuration. I had set the ENV['HOST'] to the actual domain and restarted the server. Even after this, the redirect_uri is still fixed to locahost


Rails.application.config.after_initialize do
if ShopifyApp.configuration.api_key.present? && ShopifyApp.configuration.secret.present?
ShopifyAPI::Context.setup(
api_key: ShopifyApp.configuration.api_key,
api_secret_key: ShopifyApp.configuration.secret,
api_version: ShopifyApp.configuration.api_version,
host_name: ENV['HOST'],
scope: ShopifyApp.configuration.scope,
is_private: !ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', '').empty?,
is_embedded: ShopifyApp.configuration.embedded_app,
session_storage: ShopifyApp::SessionRepository,
logger: Rails.logger,
private_shop: ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', nil),
user_agent_prefix: "ShopifyApp/#{ShopifyApp::VERSION}"
)

ShopifyApp::WebhooksManager.add_registrations
end
end