Skip to content

Commit

Permalink
Hit client.svc on the root site collection to avoid being redirected …
Browse files Browse the repository at this point in the history
…there
  • Loading branch information
jansenbe committed Feb 3, 2022
1 parent fde5f2f commit 78a4acf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sdk/PnP.Core/Services/Core/PnPContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,8 @@ internal async Task SetAADTenantId()
{
if (GlobalOptions.AADTenantId == Guid.Empty && Uri != null)
{
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{Uri}/_vti_bin/client.svc"))
// Hit client.svc on the root site collection to avoid being redirected there
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{Uri.Scheme }://{Uri.DnsSafeHost}/_vti_bin/client.svc"))
{
request.Headers.Add("Authorization", "Bearer");
HttpResponseMessage response = await httpClient.SendAsync(request).ConfigureAwait(false);
Expand Down

0 comments on commit 78a4acf

Please sign in to comment.