This topic contains 0 replies, has 1 voice, and was last updated by  Eliot Muir 8 years, 1 month ago.

Shopify OAuth2

  • I was just playing around with using Iguana to do the OAuth2 workflow for Shopify. Thought I would record my findings. If you go to this page:

    https://docs.shopify.com/api/authentication/oauth

    In Shopify’s documentation you can see what this code is doing.

    local MyApiSecret = '521ecfe1780a998fcd52e4b6cba8e999'
    
    function Redirect(Url)
       net.http.respond{debug_result=true, headers={Location=Url}, body='', code=302}
    end
    
    function main(Data)
       local R = net.http.parseRequest{data=Data}   
       if (R.location == '/registered') then
          net.http.respond{body="Congratulations - Your application has been installed"}
          return
       end
            
       local AuthUrl = 'https://'..R.params.shop..'/admin/oauth/authorize?client_id='..MyApiSecret..'&scope=write_orders&redirect_uri=http://localhost:6544/registered'   
    
       Redirect(AuthUrl)   
    end
    

You must be logged in to reply to this topic.