Answered Microsoft Translator Access token

  • viernes, 28 de octubre de 2011 17:26
     
     

    hi,

     

    I just found out about Microsoft translation and got all details from http://msdn.microsoft.com/en-us/library/hh454950.aspx

    but when I run that code with my information on it I get  The remote server returned an error: (400) Bad Request. Exception can any one help me out please

    Thnaks

     

Todas las respuestas

  • viernes, 28 de octubre de 2011 18:50
     
     
    I am keep getting this error. I dont know what I am doing wrong 
    bj2785
  • sábado, 29 de octubre de 2011 0:09
     
     

    Hi Bhanuj,

    Just to make sure: you've registered here https://datamarket.azure.com/developer/applications/ and got your client_id and client_secret, right?  Someone from our team will get back to you.  Thanks for your patience.  Takako --Microsoft Translator Team--

  • lunes, 31 de octubre de 2011 13:07
     
     

    Yes I am registered to  https://datamarket.azure.com/developer/applications/ and I do have client_id and client_secret, right. I dont know something just doesn't make sense 

     

    Thanks



    bj2785
  • lunes, 31 de octubre de 2011 16:13
     
     

    I've getting the same thing …

     

    I've created AppId

    Trying to use it as followed http://msdn.microsoft.com/en-us/library/ff512421.aspx

     

    But I've got the following error: The remote server returned an error: (400) Bad Request.

     

    It happens over this line response = httpWebRequest.GetResponse();

     

    thanks

     

  • martes, 01 de noviembre de 2011 18:47
     
     
    Hi.have you got a solution??? i am facing the same problem? thanks
  • miércoles, 02 de noviembre de 2011 14:20
     
     
    Is any one have solution for this?
    bj2785
  • miércoles, 02 de noviembre de 2011 14:22
     
     
    I am getting this error when I try to get App ID
    bj2785
  • viernes, 18 de noviembre de 2011 22:25
     
     

    The sample was incorrect and will be updated soon.

    The clientSecret parameter has to be UrlEncoded.

    Thanks,

    Max

  • viernes, 25 de noviembre de 2011 9:01
     
     

    Thanks, yes I found that this was the problem.

    string request = string.Format(@"grant_type=client_credentials&client_id={0}&client_secret={1}&scope=http://api.microsofttranslator.com", clientId, HttpUtility.UrlEncode(clientSecret));

     

    The sample is still not fixed though.

     

    regards
    Dave

     

  • miércoles, 30 de noviembre de 2011 2:22
    Propietario
     
     Respondida

    Hi Dave,

    the sample is fixed now. Sorry for taking a while. The client secret needs a UrlEncode().

    Let us know if you run into something else.

    Chris Wendt
    Microsoft Translator


  • jueves, 15 de diciembre de 2011 20:52
     
     

    Hey Chris,

    Do access token stays same all the time or each request it changes?

    Thanks


    bj2785
  • jueves, 15 de diciembre de 2011 22:13
    Propietario
     
     Respondida

    The access token in valid for 10 minutes. The next access token you request will be different.

    Chris Wendt
    Microsoft Translator

    • Marcado como respuesta Bhanuj viernes, 16 de diciembre de 2011 15:25
    •  
  • viernes, 16 de diciembre de 2011 15:23
     
     

    So which exception i'll get if Access token is expired on SOAP Call?


    bj2785
  • viernes, 16 de marzo de 2012 22:31
     
     Respuesta propuesta Tiene código

    So which exception i'll get if Access token is expired on SOAP Call?


    bj2785

    If anyone's using the Client Profile for .NET instead of the full profile then you won't access to the HttpUtility.UrlEncode you will need to use Uri.EscapeDataString instead. DO NOT use Uri.EscapeUriString as it will NOT work.

    After much trial and error this is what works for me:

    string.Format(@"grant_type=client_credentials&client_id={0}&client_secret={1}&scope=http://api.microsofttranslator.com", Uri.EscapeDataString(Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(clientId))), Uri.EscapeDataString(Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(clientSecret))))

    • Propuesto como respuesta jk sdkfj viernes, 16 de marzo de 2012 22:32
    •