costa
costa

Reputation: 33

how to hide my Google translate API key?

I am using jquery translate which uses Google translate to provide the service. I am actually paying for the translation service. However, some websites just grabbed my API key (including code) and used it. In the end, I have to pay for them. Thus, I am wondering if there is a way to hide the key.

code:

<script language="javascript"> 

$.translate.load("API key");

$(document).ready(function(){

$("#submit").click(function() {

    $.translate('text', 'en','es', {
            complete: function(translation){
             }

    });




})

Upvotes: 3

Views: 2131

Answers (2)

sikander
sikander

Reputation: 2286

Per Google's API Guide:

You can specify which domains are allowed to use your API key by clicking the Edit allowed referers link in the Simple API Access section of the API Access pane in the APIs Console.

Go to the API Console and modify accordingly.

Upvotes: 4

tvgemert
tvgemert

Reputation: 1486

You could restrict access to API based on IP or referrer.

Upvotes: 0

Related Questions