Next.js application for StorX OAuth integration and file management.
- Install dependencies:
npm install- Create
.env.local:
STORX_CLIENT_ID=your_client_id
STORX_CLIENT_SECRET=your_client_secret
STORX_REDIRECT_URI=http://localhost/callback
STORX_OAUTH_URL=http://localhost:10002/oauth2-integration
STORX_AUTH_API_URL=https://auth.storx.io/v1
STORX_OAUTH_SCOPES=read,write,list # REQUIRED: Comma-separated OAuth scopesIf your STORX_CLIENT_SECRET contains $ characters (like bcrypt hash: $2a$10$...), you MUST escape them:
❌ WRONG (will be truncated):
STORX_CLIENT_SECRET="$2a$10$LR75iqpT.fYmU46yOdy0BuH1nCx6gDmS91tturfasum2IKVabH1Nm"✅ CORRECT (escape $ as $):
STORX_CLIENT_SECRET=\$2a\$10\$LR75iqpT.fYmU46yOdy0BuH1nCx6gDmS91tturfasum2IKVabH1NmOr use without quotes (recommended):
STORX_CLIENT_SECRET=$2a$10$LR75iqpT.fYmU46yOdy0BuH1nCx6gDmS91tturfasum2IKVabH1NmNote: Next.js .env files don't require quotes. If you see only part of your secret in logs, the $ characters weren't escaped properly.
OAuth Scopes Configuration (REQUIRED):
- Environment Variable: REQUIRED - Set
STORX_OAUTH_SCOPESin.env.local(e.g.,read,write,list,delete) - Query Parameter: Optional - Pass
?scopes=read,write,listto/api/auth/loginfor dynamic override - Note: Scopes must be explicitly configured - no default fallback to ensure security and explicit permissions
Available Scopes:
read- Permission to read/download fileswrite- Permission to write/upload fileslist- Permission to list buckets/objectsdelete- Permission to delete objects- Custom scopes as per StorX OAuth2 documentation
- Run development server:
npm run devapp/
├── api/
│ ├── auth/ # OAuth endpoints
│ └── storx/ # StorX API endpoints
├── callback/ # OAuth callback handler
├── dashboard/ # Dashboard page
└── page.tsx # Home page
components/ # UI components
lib/ # Utilities (crypto, storx, s3-credentials)