Updating app scope

Diego_C
Tourist
4 0 1

Hi there,

I have written an app with node and react for a customer. However I need to update the app scope, but for the life of me I can not figure out how. The documentation is unclear to me: https://shopify.dev/tutorials/authenticate-with-oauth . How do I go about prompting a fresh authorization without removing the app? 

Thanks in advance!

Replies 7 (7)

policenauts
Shopify Partner
206 10 67

I don't think there is a clean way to do this. I've had to email customers and provide them with a new OAuth URL to my app that includes the updated scope. With my app this will update their access token accordingly (which now includes the new scope), and shouldn't show them billing again. If you built yours using Shopify CLI or the stock node / react app from Shopify though, not sure how it will behave. 

Diego_C
Tourist
4 0 1
Thanks for your response. I have been trying to get that OAuth url to work, but it either gave back a message that the api key was unknown or that the request could not be verified. I have tried redirecting my user to the url in the documentation here: https://shopify.dev/tutorials/authenticate-with-oauth. And I couldn’t find any other documentation showing how it should be done. I suspect it has something to do with the nonce, which I’ve tried many different things for.
policenauts
Shopify Partner
206 10 67

@Diego_C nonce in my experience isn't actually required, you should be able to manually create the OAuth URL and have it work. Can you paste in an example URL that you're trying to send to the merchant? Are you sure the client_id matches your app's api key?

Diego_C
Tourist
4 0 1

This is the code I'm using @policenauts 

        // Redirect to app with shop parameter upon auth
        ctx.redirect(
          `https://${shop}/admin/oauth/authorize?client_id=${SHOPIFY_API_KEY}&scope=${SCOPES}&redirect_uri=${redirect}&state=${nonce}&grant_options[]=offline`
        );

 

policenauts
Shopify Partner
206 10 67

Yes, I think you're right that it likely has to do with nonce in your case. Did you build this with Shopify CLI? If so, you might be best served asking that by raising a shopify_cli github issue and asking how to do this. 

Diego_C
Tourist
4 0 1

Yes I did, thanks for the tip!

nsupport
Shopify Partner
3 0 0

@Diego_C  Which file do we have to add this code.