Web services API Keys and Ajax - Securing the Key

后端 未结 5 1862
轮回少年
轮回少年 2020-12-23 23:23

This is probably a generic security question, but I thought I\'d ask in the realm of what I\'m developing.

The scenario is: A web service (WCF Web Api) that uses an

5条回答
  •  北海茫月
    2020-12-23 23:43

    It depends on how the API key is used. API keys like that provided by Google are tied to the URL of the site originating the request; if you try and use the key on a site with an alternate URL then the service throws and error thus removing the need to protect the key on the client side.

    Some basic API's however are tied to a client and can be used across multiple domains, so in this instance I have previously gone with the practice of wrapping this API in server side code and placing some restrictions on how the client can communicate with the local service and protecting the service.

    My overall recommendation however would be to apply restrictions on the Web API around how keys can be used and thus removes the complications and necessity of trying to protect them on the client.

提交回复
热议问题