diff --git a/Octokit/Http/SimpleJsonSerializer.cs b/Octokit/Http/SimpleJsonSerializer.cs index 232167e6..91d54df9 100644 --- a/Octokit/Http/SimpleJsonSerializer.cs +++ b/Octokit/Http/SimpleJsonSerializer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Reflection; @@ -123,6 +124,17 @@ namespace Octokit.Internal return Enum.Parse(underlyingType, stringValue, ignoreCase: true); } } + + if (ReflectionUtils.IsTypeGenericeCollectionInterface(type)) + { + // OAuth tokens might be a string of comma-separated values + // we should only try this if the return array is a collection of strings + var innerType = ReflectionUtils.GetGenericListElementType(type); + if (innerType.IsAssignableFrom(typeof(string))) + { + return stringValue.Split(','); + } + } } return base.DeserializeObject(value, type);