Securing an API for use with Javascript widget

后端 未结 1 676
温柔的废话
温柔的废话 2020-12-31 19:32

I\'m writing a javascript plugin which will be installed by bloggers/website owners. It will communicate with my remote API.

I\'m wondering how to secure the API to

相关标签:
1条回答
  • 2020-12-31 20:04

    You can insert window.location checks into your script to prevent other people from including it directly off of your servers.

    However, it is impossible to prevent people from downloading the scripts locally, removing your protection, then hosting it themselves.

    You can require an API key in all server-side requests, but enemies can easily steal API keys from legitimate sites.

    0 讨论(0)
提交回复
热议问题