Customer registration form using the admin API

I developed a customer registration form using the admin API, all via HTML and JS, using fetch in a register-custom.liquid file. In development environment it works, but when uploading to production it gives a cors error.
How do I use this proxy application? Would I have to redo everything inside the proxy application?
What is the best way to do this?

Hey @regis.cuba :waving_hand: - the CORS error there is likely expected. Our Admin API isn’t meant to be called directly from within a user’s browser. There’s a decent amount of info in this older Stack Overflow thread that is still relevant today though.

You would need to set up an App Proxy client for your app to enable this: Display dynamic store data with app proxies.

Hope this helps as a start, but let me know if I can clarify anything more on our end here or if you hit any blockers using that, happy to help!

1 Like

Sorry, I have no experience with this. I read the documentation for the proxy application, but I don’t understand it.

For example, how would you configure the admin API to register a client?
Can you record a video showing this step by step on how to configure a proxy app?
I’m currently using it like this in a liquid file:

The Admin API is meant to be used in a trusted server context and should NEVER be invoked within the users browser.

If you are looking for a way to perform user registrations within liquid take a look at the corresponding theme form.

Kevin :hatching_chick:

2 Likes

The form is more complex than it seems, it involves other external API queries and also the Shopify company creation API, all of this when registering. The fastest solution I found so far was to configure these admin APIs on a server (dogitalocean) and generate a new route to be called on the front end. without using a proxy app shopify, will it work?

1 Like

You probably just want to make sure you add some security to the route to ensure it can’t be called from absolutely anywhere.

2 Likes

Yes, this could work

1 Like