If I'm not mistaken, the middleware runs before the actual request right? Which means that my r.URL.Query().Get("shop") will never be available to the middleware before redirecting to http://localhost:2020/login.
But it's necessary because shopify doesn't auth with a generic https://shopify.com/oauth/authorize style endpoint, but rather with a account specific endpoint that looks like this: https://{shop}.myshopify.com/admin/oauth/authorize. The shop query param I'm trying to pass in would replace that {shop} in the URL and is provided to the code when you go to http://localhost:2020/?shop=shopNameHere.myshopify.com. The authenticator function should redirect to /login and pass the 'shop' param through but it doesn't.
I'm doing the oauth dance with an API (Shopify) that is making it difficult on me to write an authenticator function. Currently it looks like this:
If I'm not mistaken, the middleware runs before the actual request right? Which means that my
r.URL.Query().Get("shop")
will never be available to the middleware before redirecting to http://localhost:2020/login.But it's necessary because shopify doesn't auth with a generic https://shopify.com/oauth/authorize style endpoint, but rather with a account specific endpoint that looks like this:
https://{shop}.myshopify.com/admin/oauth/authorize
. The shop query param I'm trying to pass in would replace that{shop}
in the URL and is provided to the code when you go tohttp://localhost:2020/?shop=shopNameHere.myshopify.com
. The authenticator function should redirect to/login
and pass the 'shop' param through but it doesn't.So what can I do here?