How it is possible to not expose you secret key with a Javascript OAuth library?

后端 未结 3 1256
一向
一向 2021-02-02 10:09

Looking at Twitter OAuth Libraries, I saw this note:

Be cautious when using JavaScript with OAuth. Don\'t expose your keys.

Then, lo

3条回答
  •  无人共我
    2021-02-02 10:45

    You could also make a script that sends all necessary values and parameters to the server to do the signing with.

    The signed URL can then be sent back to the client (browser) that in turn does the actual request.

    I have implemented OAuth 1.0a on the Twitter API that way using jsonp requests. The benefit of this is that the response body is not relayed via your server, saving bandwidth.

    That way you can have your cookie and eat it too.

提交回复
热议问题