locked
JsonWebToken.CS is Broken! RRS feed

  • Question

  • Correct me if I am wrong, but the JSONWEBTOKEN.CS class in the ASP.NET samples of the Live SDK is Broken or has a bug.

    According to the documentation readme, the constructor takes a dictionary of your client secret and a string of your authentication token string.

    It then tries to split this string into a string array using a period --> string[] segments = token.Split('.');

    But the authentication token does not have any "dot", "period", "fullstops" "." in it, thus it will fail on the next line of code checking that the array is not equal to 3?

    Am I missing something here, because that how the readme told me how to do it.

    Friday, February 3, 2012 1:18 PM

Answers

All replies

  • Did you receive any error when running the sample? If yes, what was the error?
    Regards!!! Navdeep Bawa
    Saturday, February 4, 2012 6:36 AM
    Moderator
  • Yes because the next line of code after

    string[] segments = token.Split('.');

    is this...

    if (segments.Length != 3)

                {
                    throw new Exception("Invalid token format. Expected
    Envelope.Claims.Signature");
                }

     So yes this is the error I get, because there are no '.' in the Auth string

    Sunday, February 5, 2012 4:35 AM
  • Hi, please make sure you're taking the "authentication_token", not the "access_token" or "refresh_token".  The "authentication_token" has two "dot" characters that separates the token data and its signature.

    Thanks.


    Shelly Guo - MSFT
    Monday, February 6, 2012 5:13 PM
  • ok, now I see, how do I get the "authentication_token"?
    Tuesday, February 7, 2012 11:39 PM
  • ok, now I see, how do I get the "authentication_token"?
    Please read the documentation at http://msdn.microsoft.com/en-us/live/hh561433
    Wednesday, February 8, 2012 3:56 AM