public static OAuth2Message CreateFromEncodedResponse(string responseString) { if (responseString.StartsWith("{\"error")) { return(OAuth2ErrorResponse.CreateFromEncodedResponse(responseString)); } return(OAuth2AccessTokenResponse.Read(responseString)); }
public static OAuth2ErrorResponse CreateFromEncodedResponse(string responseString) { OAuth2ErrorResponse oAuth2ErrorResponse = new OAuth2ErrorResponse(); oAuth2ErrorResponse.DecodeFromJson(responseString); if (string.IsNullOrEmpty(oAuth2ErrorResponse.Error)) { throw new System.ArgumentException("Error property is null or empty. This message is not a valid OAuth2 error response.", "responseString"); } return(oAuth2ErrorResponse); }