A web application for visualizing Autodesk Platform Services (APS) Token Flex usage data with interactive charts. The usage data can only be retrieved by customers with an enterprise plan.
- OAuth 2.0 authentication with Autodesk
- Six interactive charts displaying Token Flex usage metrics
- Modern UI with Chart.js visualizations
Before you begin, ensure you have:
- Node.js (version 14 or higher)
- An Autodesk Platform Services account
- APS Client ID and Client Secret from APS Portal
git clone https://github.com/autodesk-platform-services/aps-tokenflex.git
cd aps-tokenflex-webappnpm installCreate a .env file in the root directory:
touch .envAdd the following environment variables to your .env file:
APS_CLIENT_ID=your_client_id_here
APS_CLIENT_SECRET=your_client_secret_here
APS_CALLBACK_URL=http://localhost:8080/api/auth/callback
SERVER_SESSION_SECRET=your_random_secret_phrase_hereImportant Configuration Details:
- APS_CLIENT_ID: Get this from your APS application
- APS_CLIENT_SECRET: Found in the same location as your Client ID
- APS_CALLBACK_URL: Must match the callback URL configured in your APS app settings (default:
http://localhost:8080/api/auth/callback) - SERVER_SESSION_SECRET: Create a random string for encrypting session cookies (e.g.,
my-super-secret-phrase-12345)
- Go to APS Developer Portal
- Create a new application or select an existing one
- Add the callback URL:
http://localhost:8080/api/auth/callback - Enable the following API scopes:
data:readdata:write- Add any other scopes your application requires
npm startThe application will start on http://localhost:8080
aps-tokenflex-webapp/
├── wwwroot/ # Frontend files
│ ├── index.html # Main HTML page
│ ├── main.js # Main application logic
│ ├── main.css # Styles
│ ├── login.js # Chart configurations
│ └── chatbot.js # Chatbot functionality
├── routes/ # Express routes
│ └── auth.js # Authentication routes
├── services/ # Backend services
│ └── aps.js # APS SDK integration
├── config.js # Configuration loader
├── server.js # Express server setup
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
└── package.json # Dependencies
- Click the "Login" button in the top-right corner
- Sign in with your Autodesk account
- Authorize the application
- After login, select a contract number from the dropdown menu
- Six charts will display different usage metrics:
- Usage by category
- Product-wise distribution
- Time-series trends
- And more...
GET /api/auth/login- Initiate OAuth loginGET /api/auth/callback- OAuth callback handlerGET /api/auth/logout- Logout userGET /api/auth/profile- Get user profileGET /api/contract- Get available contractsPOST /api/submit-dropdown- Submit selected contractPOST /api/chatbot- Chatbot message handler