Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript encrypt your public api key?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #194269
    claire2013
    Participant

    hey guys,

    I’m working on a portfolio and would like to show my skills in ajax and json by requesting information from other sites.

    How would I encrypt my registered API key so it’s not visible to anyone who opens up developer tools?

    I tried searching the web for this and didn’t find any answers, so I’m hoping someone can point me in the right direction.

    Thanks!

    #194287
    claire2013
    Participant

    Sorry for the confusion as I’m a little confused myself.

    ex. I register with The Weather Channel for an API key, to request data to display on my site. My generated key will be used in my Javascript file which can be viewed by anyone using the browser. How can I encrypt it before deployment so no one else can see or use it?

    #194290
    claire2013
    Participant

    By generated, I mean the key that was given to me after registering with the site. Is that the public key or private key?

    I was only given one key to use in my URL request.

    In the example below where you see MYKEYHERE. Is it ok for that key to be exposed?

    example:

    $.ajax({
    url: ‘http://api.wunderground.com/api/MYKEYHERE/conditions/q/CA/San_Francisco.json’,
    dataType: ‘jsonp’
    }

    #194371
    claire2013
    Participant

    I seen that in the docs, but I second guess myself because I read somewhere that your API key should be private, and I wasn’t quite sure what exactly was meant by that.

    So if my site, would anyone be able to see that information?

    Sorry for my paranoia, lol.

    #194397
    claire2013
    Participant

    I read it somewhere on stack overflow a few weeks ago, and it was referring to an API in general. I don’t remember the actual conversation though.

    You’ve made it crystal clear that it’s ok and I feel confident now in using it. Thanks!

    #194398
    claire2013
    Participant

    Thanks for that information. I’ll definitely check that out for future reference.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.