Skip to content

Commit

Permalink
fix(core): Parse the redirect URL correctly to retrieve the access co…
Browse files Browse the repository at this point in the history
…de (#2362)

Or throw an exception with clear meaning.
  • Loading branch information
AlanRynne authored Mar 30, 2023
1 parent bec4b6a commit 1333174
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Core/IntegrationTests/Fixtures.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Net.Mime;
using System.Text;
using System.Web;
using Newtonsoft.Json;
using Speckle.Core.Api;
using Speckle.Core.Credentials;
Expand Down Expand Up @@ -66,7 +67,10 @@ public static async Task<Account> SeedUser()
throw new Exception($"Cannot seed user on the server {Server.url}", e);
}

var accessCode = redirectUrl.Split("?access_code=")[1];
var uri = new Uri(redirectUrl);
var query = HttpUtility.ParseQueryString(uri.Query);

var accessCode = query["access_code"] ?? throw new Exception("Redirect Uri has no 'access_code'.");
var tokenBody = new Dictionary<string, string>()
{
["accessCode"] = accessCode,
Expand Down

0 comments on commit 1333174

Please sign in to comment.