Skip to content

Commit 8ba28f4

Browse files
christian-kreuzberger-dtxMrMannyCopilot
committed
Apply suggestions from code review
Co-authored-by: Manuel Warum <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 892e5eb commit 8ba28f4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/authentication/dynatrace-clients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { requestTokenForClientCredentials } from './dynatrace-oauth-client-crede
88

99
/**
1010
* Create a Dynatrace Http Client (from the http-client SDK) based on the provided authentication credentials
11-
* Supports Platform Token, Oauth Client Credentials Flow, and OAuth Authorization Code Flow (interactive)
11+
* Supports Platform Token, OAuth Client Credentials Flow, and OAuth Authorization Code Flow (interactive)
1212
* @param environmentUrl
1313
* @param scopes
1414
* @param clientId
@@ -67,7 +67,7 @@ const createPlatformTokenHttpClient = async (environmentUrl: string, dtPlatformT
6767
};
6868

6969
/**
70-
* Create an Oauth Client based on clientId, clientSecret, environmentUrl and scopes
70+
* Create an OAuth Client based on clientId, clientSecret, environmentUrl and scopes
7171
* This uses a client-credentials flow to request a token from the SSO endpoint.
7272
* Note: We do not refresh the token here, we always request a new one on each client creation.
7373
*/

src/authentication/dynatrace-oauth-auth-code-flow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export function createAuthorizationUrl(ssoBaseURL: string, config: OAuthAuthoriz
4040

4141
const queryString = queryParts.join('&');
4242

43-
const finalUrl = `${authUrl.origin}${authUrl.pathname}?${queryString}`; // What??? Why???
43+
// Manually construct the final URL to ensure exact parameter order and encoding required by some OAuth implementations.
44+
const finalUrl = `${authUrl.origin}${authUrl.pathname}?${queryString}`;
4445

4546
return {
4647
authorizationUrl: finalUrl,

src/authentication/dynatrace-oauth-client-credentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { OAuthTokenResponse } from './types';
44
/**
55
* Uses the provided oauth Client ID and Secret and requests a token via client-credentials flow
66
* @param clientId - OAuth Client ID for Dynatrace
7-
* @param clientSecret - Oauth Client Secret for Dynatrace
7+
* @param clientSecret - OAuth Client Secret for Dynatrace
88
* @param ssoBaseURL - SSO Base URL (e.g., sso.dynatrace.com)
99
* @param scopes - List of requested scopes
1010
* @returns Response of the OAuth Endpoint (which, in the best case includes a token)

0 commit comments

Comments
 (0)