locked
how does the access token time limit work RRS feed

  • Question

  • Hi,

     

    I understand that the access token lasts 10 minutes, should a separate access token be used for each translation or do you register a call back to update the access token, If the first case is true it seems to create unnecessary extra traffic, if the second case is true is there an code example.

     

    Thanks

     

    David


    Sunday, December 18, 2011 8:58 PM

All replies

  • Hi David,

    It depends….a better strategy would be to check for errors returned because of token invalid (i.e. expired) and only in that case do get a new token.  That way, it works for a scenario in which a succession of translate calls are made within 10 minutes (one token is enough) and for scenarios in which fewer and far in between calls are made exceeding the token lifetime (anytime a token expires, the app will request a new one and retry the last request).

    For a code sample, we can’t really provide a callback on timer example, since for once we don’t know which language you’re using.  You might want to do a Bing search for “expired access token”.

     

     

    Hope that this is helpful.  Thanks.  Takako (Microsoft Translator Team)

    Tuesday, December 20, 2011 6:26 PM
  • Hi,

     

    Actually, I want to make the call using client side javascript. The application is a browser extension and therefore wants to be self contained without calls to another server, the token request would be from the browser process rather than run from with the clients DOM (there is messaging between the browser and the client DOM), however there may still be security issues. It currently works using a fixed token, but I want to change for the token method also I want users to obtain a token and use their information to obtain a token. This is not my favoured approach but the only approach I can conceive off to get the service working without running into translation limits problems (if my token is used by lots of users).

     

    Cheers

     

    Dave


    Tuesday, December 20, 2011 9:52 PM