My company provide services to other websites. I would like to be able to give them a simple snippet of code to embed in their site (like a widget) that will send a query to the service I'm implementing, receive a response and render the results in the page. I'd like to minimize their effort, and only give them the smallest snippet possible. This is also why I'd like to keep it all client side.
The problem is that I'd like to make sure that the call is actually made by my clients and not by anyone else who copied the code from the site. I looked into the web client oauth2 flow, but it seems that it does not enable to authenticate the client. It does say that there's a way to validate the client by comparing the callback URL to a URL that the client registered with my service.
My Questions:
- Is there any better approach?
- Is the oauth2 client side approach, including the method described to validate the client, sufficiently secure?
- If I go for the suggested implementation, what should I pay attention to?