Restricting Javascript Widgets to Registered Sites Discussion
Discussion for
Restricting Javascript Widgets to Registered Sites
In this example you first render the javascript and make another call to API via fetch and check the domain in API controller. Is there a specific reason for that?
Isn't it better to check the domain at embeds-controller and if domain is not registered, we will not have to render any javascript on client side.
We can get the domain by checking headers with something like URI.parse( request.env["HTTP_REFERER"])
I'm getting a NoMethodError (undefined method `sites' for nil:NilClass) error from the part at 18:37, any suggestions?