Skip to content

Commit d1bcafb

Browse files
committed
simplify logging
1 parent bc133dd commit d1bcafb

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

bin/test-auth-flow.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,17 @@ class CLIAuthFlowTester {
110110
// Log step-specific success information
111111
switch (stepName) {
112112
case 'metadata_discovery':
113-
this.success('METADATA DISCOVERY', 'OAuth metadata discovered', {
114-
issuer: this.state.oauthMetadata?.issuer,
115-
authorization_endpoint: this.state.oauthMetadata?.authorization_endpoint,
116-
token_endpoint: this.state.oauthMetadata?.token_endpoint,
117-
scopes_supported: this.state.oauthMetadata?.scopes_supported,
118-
resource_metadata: this.state.resourceMetadata ? {
119-
resource: this.state.resourceMetadata.resource,
120-
authorization_servers: this.state.resourceMetadata.authorization_servers,
121-
scopes_supported: this.state.resourceMetadata.scopes_supported,
122-
} : null,
123-
resource_metadata_error: this.state.resourceMetadataError?.message,
124-
});
113+
if (this.state.resourceMetadata) {
114+
this.success('Resource Metadata', 'OAuth Resource Metadata', this.state.resourceMetadata);
115+
} else {
116+
this.error('Resource Metadata', 'Issue fetching resource metadata', this.state.resourceMetadataError);
117+
}
118+
119+
this.success('METADATA DISCOVERY', `OAuth metadata discovered, from: ${this.state.authServerUrl}`, this.state.oauthMetadata);
125120
break;
126121

127122
case 'client_registration':
128-
this.success('CLIENT REGISTRATION', 'Client registered successfully', {
129-
client_id: this.state.oauthClientInfo?.client_id,
130-
client_secret: this.state.oauthClientInfo?.client_secret ? '[REDACTED]' : undefined,
131-
client_id_issued_at: this.state.oauthClientInfo?.client_id_issued_at,
132-
client_secret_expires_at: this.state.oauthClientInfo?.client_secret_expires_at,
133-
});
123+
this.success('CLIENT REGISTRATION', 'Client registered successfully', this.state.oauthClientInfo);
134124
break;
135125

136126
case 'authorization_redirect':
@@ -144,15 +134,9 @@ class CLIAuthFlowTester {
144134
break;
145135

146136
case 'token_request':
147-
this.success('TOKEN EXCHANGE', 'Tokens obtained successfully', {
148-
access_token: this.state.oauthTokens?.access_token ? '[REDACTED]' : undefined,
149-
token_type: this.state.oauthTokens?.token_type,
150-
expires_in: this.state.oauthTokens?.expires_in,
151-
refresh_token: this.state.oauthTokens?.refresh_token ? '[REDACTED]' : undefined,
152-
scope: this.state.oauthTokens?.scope,
153-
});
137+
this.success('TOKEN EXCHANGE', 'Tokens obtained successfully', this.state.oauthTokens);
154138
break;
155-
139+
156140
case 'validate_token':
157141
this.success('TOKEN VALIDATION', 'Token validated successfully', {
158142
message: this.state.statusMessage?.message || 'Access token is valid',
@@ -289,7 +273,7 @@ class CLIAuthFlowTester {
289273
// Step 6: Exchange Code for Tokens
290274
await this.executeStep('token_request');
291275
console.log("");
292-
276+
293277
// Step 7: Validate the token by calling tools/list
294278
await this.executeStep('validate_token');
295279
console.log("");

0 commit comments

Comments
 (0)