Javascript API - Restrict Domain by providing whitelisting option to user

和自甴很熟 提交于 2019-12-10 10:57:40

问题


My Application provides an API Key and Javascript code to put on their site (similar to google anayytics code).

All the calls in the API use JSONP to communicate with our server.

Since the API key is sensitive, we have our users coming back and asking to provide a whitelisting option for the domain. This is similar to Linkedin, Facebook, Twitter and Google.

Should I be using referrer option to restrict the domain? But a rogue can always manually add this using normal http api and gain access.

Is it a good idea to encrypt (or hash?) and send the window.location within the API and compare that at the server side.

来源:https://stackoverflow.com/questions/23864036/javascript-api-restrict-domain-by-providing-whitelisting-option-to-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!