Skip to content

Commit d8f4fd2

Browse files
committed
Refactor ConstructAPIAuthEndpoint function to use Microsoft Graph API authentication endpoint
1 parent 143f29f commit d8f4fd2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

apiintegrations/msgraph/msgraph_api_url.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ func (g *GraphAPIHandler) ConstructAPIResourceEndpoint(instanceName string, endp
2525
return url
2626
}
2727

28-
// ConstructAPIAuthEndpoint constructs the full URL for a graph API auth endpoint path and logs the URL.
29-
func (g *GraphAPIHandler) ConstructAPIAuthEndpoint(instanceName string, endpointPath string, log logger.Logger) string {
30-
urlBaseDomain := g.SetBaseDomain()
31-
url := fmt.Sprintf("https://%s%s%s", instanceName, urlBaseDomain, endpointPath)
32-
g.Logger.Debug(fmt.Sprintf("Constructed %s API authentication URL", APIName), zap.String("URL", url))
28+
// ConstructAPIAuthEndpoint constructs the full URL for the Microsoft Graph API authentication endpoint.
29+
// It uses the provided tenant name and endpoint path and logs the constructed URL.
30+
func (g *GraphAPIHandler) ConstructAPIAuthEndpoint(tenantName string, endpointPath string, log logger.Logger) string {
31+
// The base URL for the Microsoft Graph API authentication endpoint.
32+
const baseURL = "https://login.microsoftonline.com"
33+
34+
// Construct the full URL by combining the base URL, tenant name, and endpoint path.
35+
url := fmt.Sprintf("%s/%s%s", baseURL, tenantName, endpointPath)
36+
37+
// Log the constructed URL for debugging purposes.
38+
log.Debug(fmt.Sprintf("Constructed Microsoft Graph API authentication URL"), zap.String("URL", url))
39+
3340
return url
3441
}

0 commit comments

Comments
 (0)