We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sidlendhe/ticktick-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
get_token.py•2.06 KiB
"""
Simple script to get TickTick access token
"""
from src.api.ticktick_api import TickTickOAuth
def get_access_token():
"""Get access token through OAuth flow"""
# Initialize OAuth
oauth = TickTickOAuth()
# Step 1: Get authorization URL
print("="*60)
print("STEP 1: Get Authorization")
print("="*60)
auth_url = oauth.get_authorization_url()
print(f"\n👉 Click or copy this URL to your browser:\n\n{auth_url}\n")
# Step 2: User authorizes and gets code
print("="*60)
print("STEP 2: Authorize and Get Code")
print("="*60)
print("After you authorize, you'll be redirected to a URL like:")
print("http://localhost:8000/auth/ticktick/callback?code=XXXXX&state=...")
print("\nCopy the 'code' parameter from that URL (the XXXXX part)\n")
authorization_code = input("Enter the authorization code: ").strip()
if not authorization_code:
print("❌ No code provided!")
return None
# Step 3: Exchange code for token
print("\n" + "="*60)
print("STEP 3: Exchange Code for Token")
print("="*60)
token_data = oauth.exchange_code_for_token(authorization_code)
if token_data:
print("\n✅ SUCCESS! Got access token!\n")
access_token = token_data['access_token']
print(f"Your access token is:\n{access_token}\n")
print("="*60)
print("Save this token to your .env file:")
print("="*60)
print(f"\nAdd this line to your .env file:")
print(f"TICKTICK_ACCESS_TOKEN={access_token}\n")
# Offer to save it automatically
save = input("Would you like me to save it to .env automatically? (y/n): ").strip().lower()
if save == 'y':
with open('.env', 'a') as f:
f.write(f"\nTICKTICK_ACCESS_TOKEN={access_token}\n")
print("✅ Token saved to .env file!")
return access_token
else:
print("\n❌ Failed to get access token")
print("Please check that you copied the correct authorization code")
return None
if __name__ == "__main__":
get_access_token()