App reviews, troubleshooting, and recommendations
Hi,
I am trying to test installing my app on my development store.
When I go to test app on development store, I am redirected back to my site. The parameter code is missing. This means I cannot obtain an access token, then send the user to Shopify to pay. Here is the URL that I receive:
hmac=X&host=Y&shop=myshop.myshopify.com×tamp=1701874522
How do I get a code, so I can make an access token?
Solved! Go to the solution
This is an accepted solution.
Hi,
The auth process includes few steps:
At first you need to verify the installation request from Shopify (you are here)
Then you need to redirect user back to Shopify so he can confirm it and give you an access to his data
Then he will be redirected to your site again and you will need to obtain an access token from the oauth server
The whole process is described here, please follow it step by step and you will make it
This is an accepted solution.
Hi,
The auth process includes few steps:
At first you need to verify the installation request from Shopify (you are here)
Then you need to redirect user back to Shopify so he can confirm it and give you an access to his data
Then he will be redirected to your site again and you will need to obtain an access token from the oauth server
The whole process is described here, please follow it step by step and you will make it
Hi this does not address the issue. The problem is when it is redirected to our site again, the code parameter is missing thus unable to request for the access token. Any solution for this ?
hi did you manage to get the working solution for this ?
Hi Were you able to find a working solution for this?
Hi,
You need to redirect the user back to the store. If my store was jmatestshop.myshopify.com, here is the URL I would use:
C#:
public string GetAuthorizationURL(string[] scope, string? redirectUrl = null)
{
var authURL = new StringBuilder();
authURL.AppendFormat("http://{0}.myshopify.com/admin/oauth/authorize", this._shopName);
authURL.AppendFormat("?client_id={0}", this._apiKey);
if (scope != null && scope.Length > 0)
{
string commaSeperatedScope = String.Join(",", scope);
if (!String.IsNullOrEmpty(commaSeperatedScope))
authURL.AppendFormat("&scope={0}", HttpUtility.UrlEncode(commaSeperatedScope));
}
if (redirectUrl != null && redirectUrl.Length > 0)
{
authURL.AppendFormat("&redirect_uri={0}", HttpUtility.UrlEncode(redirectUrl));
}
return authURL.ToString();
}
Once the user accepts the install, send the user back to your page:
[HttpPost("ShopifyAuthCallback")]
public async Task<IActionResult> ShopifyAuthCallback()
{
ShopifyPaymentModel shopifyPaymentModel = new ShopifyPaymentModel();
string connexUserId = User.GetConnexUserId();
string jsonString;
using (StreamReader sr = new StreamReader(Request.Body, Encoding.UTF8))
{
jsonString = sr.ReadToEnd();
}
var ShopifyInstallOAuth = JsonConvert.DeserializeObject<ShopifyInstall>(jsonString);
//ShopifyInstallOAuth will have the code. Exchange for an access token.
I could add some code here, if necessary:
https://github.com/jmawebtech/Shopify-C--GraphQL
}
Thanks for the detailed explanation and code sample! This approach makes sense. I'll implement the redirection using the GetAuthorizationURL method and handle the callback using the ShopifyAuthCallback method. The GitHub link for additional code is a great resource—appreciate it! Let me know if you have more tips for setting this up.
Hi,
Sure, please reply if you have more questions. Are you implementing the Shopify billing API? If so, you must redirect the user to Shopify to pay, then pair Shopify with your software. OAuth will only work, if Shopify approves you for their app store.
After you get the code and get the access token, send the user here:
Once the user approves, there is a parameter called redirect_url. Send the user to a payment success page on your site.
Thank you for the details! Yes, I am working with the Shopify Billing API, and your explanation helps clarify the flow. I'll ensure the user is redirected to Shopify for payment and then paired with my software. After obtaining the access token, I'll integrate the redirect_url to guide users to a payment success page on my site for a seamless experience.
Appreciate your guidance—let me know if there's anything else I should watch out for!
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024