Update GitHub authorization method because previous method is deprecated

This commit is contained in:
Jaex 2020-02-04 17:57:26 +03:00
parent 55cf449be4
commit ba447fa171

View file

@ -29,6 +29,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Linq;
using System.Net;
@ -142,10 +143,10 @@ public override UploadResult UploadText(string text, string fileName)
string json = JsonConvert.SerializeObject(gistUpload);
Dictionary<string, string> args = new Dictionary<string, string>();
args.Add("access_token", AuthInfo.Token.access_token);
NameValueCollection headers = new NameValueCollection();
headers.Add("Authorization", "token " + AuthInfo.Token.access_token);
string response = SendRequest(HttpMethod.POST, url, json, RequestHelpers.ContentTypeJSON, args);
string response = SendRequest(HttpMethod.POST, url, json, RequestHelpers.ContentTypeJSON, null, headers);
GistResponse gistResponse = JsonConvert.DeserializeObject<GistResponse>(response);