dbx-mcp-server
Version:
A Model Context Protocol server for Dropbox integration with AI-powered PDF analysis, multi-directory indexing, and parallel processing
30 lines • 1.14 kB
JavaScript
import * as auth from './auth.js';
import { createInterface } from 'readline';
const rl = createInterface({
input: process.stdin,
output: process.stdout
});
async function exchangeCode() {
try {
// Prompt for authorization code and code verifier
const code = await new Promise((resolve) => {
rl.question('Enter the authorization code from the redirect URL: ', resolve);
});
const codeVerifier = await new Promise((resolve) => {
rl.question('Enter the code verifier from the previous step: ', resolve);
});
// Exchange code for tokens
const tokens = await auth.exchangeCodeForTokens(code.trim(), codeVerifier.trim());
console.log('\nSuccess! Tokens have been saved.');
console.log('Access token expires at:', new Date(tokens.expiresAt).toLocaleString());
console.log('Scopes:', tokens.scope.join(', '));
}
catch (error) {
console.error('\nError exchanging code for tokens:', error);
}
finally {
rl.close();
}
}
exchangeCode().catch(console.error);
//# sourceMappingURL=exchange-code.js.map