Answered by:
is there a javascript code example to get access token

Question
-
Hi,
Do you have a working example in Javascript for how to obtain the acess token for using the bing translate API.
Thanks
Dave
Sunday, December 18, 2011 8:44 PM
Answers
-
Thanks for your reply, I am still at a loss on how to implement my translation tool. It is intended for use by many users and runs client side in a browser as a browser extension, therefore it is standalone on the users machine. However with the server side access code implementation I have a run a server capable of handling messages from all user clients as a proxy forwarding messages on to Bing translate. There is also the issue of who has the license. If I have the license then I have to purchase a bing translator license capable of handling all the user requests (the tool is intended to be free for users). Alternatively I could request each user to obtain a license in which case I will have to manage user account information on the server as well as the access token traffic and all the token timeouts for the users, and the translation message traffic (Imagine the server costs!). Also the license procedure is more geared towards to developers than end users and provides unnecessary overhead for users, who generally like things simple. All these issues mean that my translation tool is still awaiting deployment.
Do you have any suggestions for a workable solution?
Best Regards
Dave
- Marked as answer by Chris WendtMicrosoft employee Sunday, January 29, 2012 5:49 PM
Sunday, January 15, 2012 7:42 PM
All replies
-
Hi Dave,
Obtaining the access token should be done on server side as call from JavaScript to get access token will expose client id and client secret to all users. Microsoft Translator services are on Microsoft domain so you will have to use a proxy page on your own domain that will retrieve the results and return them to you. Hope that this is helpful....
Wednesday, December 21, 2011 12:15 AM -
Thanks for your reply, I am still at a loss on how to implement my translation tool. It is intended for use by many users and runs client side in a browser as a browser extension, therefore it is standalone on the users machine. However with the server side access code implementation I have a run a server capable of handling messages from all user clients as a proxy forwarding messages on to Bing translate. There is also the issue of who has the license. If I have the license then I have to purchase a bing translator license capable of handling all the user requests (the tool is intended to be free for users). Alternatively I could request each user to obtain a license in which case I will have to manage user account information on the server as well as the access token traffic and all the token timeouts for the users, and the translation message traffic (Imagine the server costs!). Also the license procedure is more geared towards to developers than end users and provides unnecessary overhead for users, who generally like things simple. All these issues mean that my translation tool is still awaiting deployment.
Do you have any suggestions for a workable solution?
Best Regards
Dave
- Marked as answer by Chris WendtMicrosoft employee Sunday, January 29, 2012 5:49 PM
Sunday, January 15, 2012 7:42 PM -
Hi Dave,
your are right, the Microsoft Translator API license is geared towards developers, system integrators, and webmasters. End users interact with your application. For you as application developer, a payment is due if your application consumes more than 2 million characters per month. The free quota is intended to allow you to develop and test your application without having to pay Microsoft before your app launches.
Chris Wendt
Microsoft TranslatorSunday, January 29, 2012 5:49 PM -
Hi Chris,
Well it is difficult to see how I can use the service then, as it was intended to be a free application. Is there any way I can be restricted to 2 million characters, as I don't like the idea in case of popularity of the application that I start to get billed by Microsoft for what is essentially a free application. Maybe I could ask subscribers for contributions and if the contributions are reasonable then I can pay to raise the limit. By the way is there an upper limit?
Cheers
Dave
Monday, January 30, 2012 12:28 PM -
Hi Dave,
you will only get billed for what you subscribed to. Microsoft Translator stops delivering translations when the quota is exceeded.
Chris Wendt
Microsoft TranslatorMonday, January 30, 2012 3:48 PM