Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shopify app oauth redirect_uri incorrect format after deployed on fly.io

Solved

Shopify app oauth redirect_uri incorrect format after deployed on fly.io

Mikevv
Shopify Partner
4 1 1

I have written a very simply Shopify app based on the latest template and I did not touch any part about the OAuth, and the app installed and worked just fine when I run in dev mode. After I deploy it on fly.io, when I try to install it, the redirect_uri in the OAuth url becomes 

redirect_uri=little-haze-0000.fly.dev://little-haze-0000.fly.dev/api/auth/callback

, and it gave an error "Oauth error invalid_request: The redirect_uri is not whitelisted" (of course it is wrong!).

 

Obviously there should be a  "https" in front of the "://". I manually change the parameter to 

redirect_uri=https://little-haze-0000.fly.dev/api/auth/callback

 and the app can be successfully installed. I looked through the code and app setting in my partner account and can't find anywhere I can modify the redirect_uri. I wonder where I did wrong?

Accepted Solution (1)
Mikevv
Shopify Partner
4 1 1

This is an accepted solution.

Thank you I have just found the issue by myself. In fly.toml I have missed the "https://" suffix in the HOST parameter: 

HOST = "little-haze-0000.fly.dev"

 I added the "https://" in front and re-deployed it and it is all good now. 

View solution in original post

Replies 2 (2)

lizk
Shopify Staff
246 58 78

Hi there 👋

Could you share what your Shopify object looks like in the Shopify.js file?  The redirect URI is using the information from that object to create the redirect URL. 

To learn more visit the Shopify Help Center or the Community Blog.

Mikevv
Shopify Partner
4 1 1

This is an accepted solution.

Thank you I have just found the issue by myself. In fly.toml I have missed the "https://" suffix in the HOST parameter: 

HOST = "little-haze-0000.fly.dev"

 I added the "https://" in front and re-deployed it and it is all good now.