Odpovědět Microsoft Translator Access token

ตอบทั้งหมด

  • 28 ตุลาคม 2554 18:50
     
     
    I am keep getting this error. I dont know what I am doing wrong 
    bj2785
  • 29 ตุลาคม 2554 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--

  • 31 ตุลาคม 2554 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
  • 31 ตุลาคม 2554 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

     

  • 1 พฤศจิกายน 2554 18:47
     
     
    Hi.have you got a solution??? i am facing the same problem? thanks
  • 2 พฤศจิกายน 2554 14:20
     
     
    Is any one have solution for this?
    bj2785
  • 2 พฤศจิกายน 2554 14:22
     
     
    I am getting this error when I try to get App ID
    bj2785
  • 18 พฤศจิกายน 2554 22:25
     
     

    The sample was incorrect and will be updated soon.

    The clientSecret parameter has to be UrlEncoded.

    Thanks,

    Max

  • 25 พฤศจิกายน 2554 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

     

  • 30 พฤศจิกายน 2554 2:22
    เจ้าของ
     
     คำตอบ

    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


  • 15 ธันวาคม 2554 20:52
     
     

    Hey Chris,

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

    Thanks


    bj2785
  • 15 ธันวาคม 2554 22:13
    เจ้าของ
     
     คำตอบ

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

    Chris Wendt
    Microsoft Translator

    • ทำเครื่องหมายเป็นคำตอบโดย Bhanuj 16 ธันวาคม 2554 15:25
    •  
  • 16 ธันวาคม 2554 15:23
     
     

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


    bj2785
  • 16 มีนาคม 2555 22:31
     
     คำตอบที่เสนอ มีโค้ด

    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))))

    • เสนอเป็นคำตอบโดย jk sdkfj 16 มีนาคม 2555 22:32
    •