/// <summary> /// Decrypt an authentication token and parse into a JsonWebToken object. /// </summary> public static bool DecodeAuthenticationToken( string authenticationToken, string clientSecret, out JsonWebToken token, out LiveAuthException error) { Debug.Assert(!string.IsNullOrEmpty(authenticationToken)); Debug.Assert(!string.IsNullOrEmpty(clientSecret)); token = null; error = null; Dictionary<int, string> keys = new Dictionary<int, string>(); keys.Add(0, clientSecret); try { token = new JsonWebToken(authenticationToken, keys); return true; } catch (Exception ex) { error = new LiveAuthException(AuthErrorCodes.ClientError, ex.Message); return false; } }
/// <summary> /// Decrypt an authentication token and parse into a JsonWebToken object. /// </summary> public static bool DecodeAuthenticationToken( string authenticationToken, object clientSecrets, out JsonWebToken token, out LiveAuthException error) { Debug.Assert(!string.IsNullOrEmpty(authenticationToken)); Debug.Assert(clientSecrets != null); token = null; error = null; try { token = new JsonWebToken(authenticationToken, clientSecrets); return true; } catch (Exception ex) { error = new LiveAuthException(AuthErrorCodes.ClientError, ex.Message); return false; } }