Facebook.OAuthContext.ParseAuthResult C# (CSharp) Method

ParseAuthResult() private method

private ParseAuthResult ( string contentType, string json ) : void
contentType string
json string
return void
        void ParseAuthResult(string contentType, string json)
        {
            switch (contentType)
            {
                case "text/plain":
                    NameValueCollection nvc = HttpUtility.ParseQueryString(json);
                    _fbSession = new Session
                    {
                        OAuthToken = nvc["access_token"],
                        Expires = DateTime.UtcNow.AddSeconds(Convert.ToInt64(nvc["expires"], CultureInfo.InvariantCulture)),
                    };

                    _fbSession.Signature = GenerateSignature(_fbSession.ToJsonObject());
                    break;
                case "text/javascript":
                    var obj = JsonObject.CreateFromString(json, CultureInfo.InvariantCulture);
                    if (obj.IsDictionary)
                        FacebookApi.ThrowIfError(obj);

                    throw FacebookApi.UnexpectedResponse(json);
                default:
                    throw FacebookApi.UnexpectedResponse(json);
            }
        }