Hi,
I have a Flow Action extension only app.
What I try to archive is to access store data from my flow action, which is realized as an AWS Lambda function. Like everytime my flow action function is invoked, an order should be created.
But I have problems to find the correct authorization mechanism. Especially I want to know, how to retrive the access token for my app. Is it even possible to have a backend only implementation for this? If I understand the documentation correct, the OAuth-Flow always needs a frontend?
Thanks,
Michael
Hi Michael,
Would using an API key be an option?
1 Like
Hi and thanks for the reply!
How would that work? The best way would allow to authorise the App at App installation, maybe via a second lambda function to store the access key. API-Key would mean, there would be the need to manually add a private app in the shop to get the API-Key, correct?
So, for everyone looking for advice here: It is possible without frontend, but the whole process is not documented very well. First of all, you have to set embedded to false in the project settings (that is, because cookies are set, which will not work otherwise). Then, on AWS, I used API Gateway HTTP-API to route to two lambda functions, which both are responsible for the authentication process. Both functions must have the same domain. The authentication is done via the @shopify/shopify-api library, Authorization Grant Flow is the way to go. You have to convert the requests and responses from the HTTP-API Lambda Payload format(search for “Create AWS Lambda proxy integrations for HTTP APIs in API Gateway” to find the documentation, as links to amzn (even the word is forbidden) docs are not allowed in this board) to node requests/responses and vice versa to use them as the parameters for the shopify.auth.begin (handled in Lambda function 1) and shopify.auth.callback (Lambda function 2) functions. The API Gateway url which routes to the first Lambda function has to be used as the application_url config parameter of the shopify app. Both urls have to be inserted in the [auth]redirect_urls parameter.
Lot of stuff to work through, but it is possible.