Skip to content

Enabling non-standard ports for on-prem using OAuth #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

korytiak
Copy link

Hello my team has been struggling adopt the new ServiceClient as we're very restricted with our old on-prem setup. We've made some advances, and are getting closer, however the best thing we can do is use the ServiceClient constructior that takes url and tokenProviderFunction. This is really the best way for us to use new ServiceClient + OAuth we've set up, however it rewrites our port 444 to 443 and that breaks the client. Thank you for considering this fix.

korytiak added 2 commits July 11, 2025 22:25
…ise options for on-prem OAuth service client are very limited

On-prem deployment very often use non-standard ports like 444
Update ConnectionService.cs to allow on-prem ports with OAuth
@korytiak korytiak changed the title Enabling non-standard prots for on-prem using OAuth Enabling non-standard ports for on-prem using OAuth Jul 18, 2025
@@ -1471,7 +1471,7 @@ private async Task<IOrganizationService> DoDirectLoginAsync(bool IsOnPrem = fals

IOrganizationService dvService = null;
Uri OrgWorkingURI = null;
if (!IsOnPrem || _eAuthType == AuthenticationType.OAuth) // Use this even if its onPrem, when auth type == oauth.
if (!IsOnPrem)
{
OrgWorkingURI = new Uri(string.Format(SoapOrgUriFormat, _targetInstanceUriToConnectTo.Scheme, _targetInstanceUriToConnectTo.DnsSafeHost));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not believe your change does what you think it does.

On line 1476, the Uri.DnsSafeHost property, just like the Uri.Host property, returns only the host portion of the URI, so even if _targetInstanceUriToConnectTo contains your port 444, it would still be stripped out of the URI generated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants