This guide will help you quickly set up and test Webex authentication for the BYOVA Gateway monitoring dashboard.
- Python 3.8+ with virtual environment activated
- Access to Webex Developer Portal
- A Webex account
- Familiarity with the OpenID Spec
- Go to https://developer.webex.com/
- Log in with your Webex account
- Click "Create an Integration" (under "My Apps")
- Fill in the form:
- Integration Name: BYOVA Gateway Monitor Dev
- Icon: Upload an icon or use default
- Description: Development environment for BYOVA Gateway monitoring
- Redirect URI:
http://localhost:8080/oauth - Scopes: No scopes required for OpenID Connect/Login with Webex integration
- Click "Add Integration"
- Save your Client ID and Client Secret - you'll need these next
- Navigate to developer.webex.com
- Sign in using Webex Credentials
- click on avatar in the top right corner
- copy Organization ID to clip board
- The access token format is:
{access_token}_{ci_cluster}_{org_id} - Split the token by underscores and take the third part
- Copy the organization ID (the third segment after splitting)
Example in a browser console or terminal:
// JavaScript
let accessToken = "your_access_token_here";
let parts = accessToken.split('_');
let orgId = parts[2];
console.log("Organization ID:", orgId);# Bash
echo "your_access_token_here" | awk -F'_' '{print $3}'- Go to https://developer.webex.com/docs/api/v1/people/get-my-own-details
- Click "Run" in the API Reference
- Look for
orgIdin the response - Copy the organization ID
# Generate a random secret key
export FLASK_SECRET_KEY="$(openssl rand -hex 32)"
# Set Webex OAuth credentials
export WEBEX_CLIENT_ID=your-client-id-from-step-1
export WEBEX_CLIENT_SECRET=your-client-secret-from-step-1
export WEBEX_REDIRECT_URI=http://localhost:8080/oauth
# Set your organization ID(s) - this is an allow list of organizations that can access the dashboard.
#This functionality can be replaced in production with a list of authorized users or similar. This is just a sample.
# For a single organization:
export AUTHORIZED_WEBEX_ORG_IDS=your-org-id-from-step-2
# For multiple organizations (comma-separated, whitespace is automatically trimmed):
# export AUTHORIZED_WEBEX_ORG_IDS="org-id-1,org-id-2,org-id-3"
# or with spaces (both formats work):
# export AUTHORIZED_WEBEX_ORG_IDS="org-id-1, org-id-2, org-id-3"Add these to your shell profile (~/.zshrc or ~/.bashrc):
# Add to ~/.zshrc or ~/.bashrc
export FLASK_SECRET_KEY="$(openssl rand -hex 32)"
export WEBEX_CLIENT_ID="Cyour-client-id"
export WEBEX_CLIENT_SECRET="your-client-secret"
export WEBEX_REDIRECT_URI="http://localhost:8080/oauth"
export AUTHORIZED_WEBEX_ORG_IDS="your-org-id"Then reload your shell:
source ~/.zshrc # or source ~/.bashrcCheck that all environment variables are set:
echo "Flask Secret: $FLASK_SECRET_KEY"
echo "Client ID: $WEBEX_CLIENT_ID"
echo "Client Secret: $WEBEX_CLIENT_SECRET"
echo "Redirect URI: $WEBEX_REDIRECT_URI"
echo "Authorized Orgs: $AUTHORIZED_WEBEX_ORG_IDS"All values should be displayed (not empty).
# Ensure virtual environment is activated
source venv/bin/activate
# Start the gateway
python main.pyYou should see output indicating both servers have started:
Starting BYOVA Gateway monitoring web app on 0.0.0.0:8080
- Open the dashboard: http://localhost:8080
- Expected behavior: You should be redirected to
/login - Click "Login with Webex"
- Authorize the integration: Log in with your Webex credentials and authorize the app
- Expected result: You should be redirected back to the dashboard
- Verify: Your name and email should appear in the top right corner
- Click the "Logout" button in the top right
- Expected behavior: You should be redirected back to the login page
- Verify: Trying to access http://localhost:8080 should redirect to login
Problem: After logging in with Webex, you see this error message.
Solution:
- Verify your organization ID is correct:
echo $AUTHORIZED_WEBEX_ORG_IDS
- Make sure the org ID matches exactly (case-sensitive)
- Restart the gateway after changing environment variables
Problem: OAuth callback fails with this error.
Solution:
- Check that your Redirect URI in the Webex Integration matches exactly:
http://localhost:8080/oauth - Make sure the
WEBEX_REDIRECT_URIenvironment variable matches - Try recreating the integration with the correct redirect URI
Problem: Gateway starts but authentication doesn't work.
Solution:
- Make sure environment variables are exported in the current shell
- Check variables are set:
env | grep WEBEX env | grep FLASK env | grep AUTHORIZED
- Restart the gateway after setting variables
- Make sure you're running from the same terminal where you set the variables
Problem: Browser keeps redirecting between login and dashboard.
Solution:
- Clear browser cookies for localhost:8080
- Check that
FLASK_SECRET_KEYis set and consistent - Make sure authentication is enabled in
config/config.yaml:authentication: enabled: true
API endpoints remain accessible without authentication:
# Test status endpoint
curl http://localhost:8080/api/status
# Test health endpoint
curl http://localhost:8080/health
# Test connections endpoint
curl http://localhost:8080/api/connectionsTo disable authentication for local testing:
- Edit
config/config.yaml:authentication: enabled: false
- Restart the gateway
- Dashboard will be accessible without login
Warning: Never disable authentication in production!
AUTHORIZED_WEBEX_ORG_IDS is an allow list (whitelist) of Webex organization IDs that controls access to the monitoring dashboard. Only users belonging to organizations listed in this variable will be granted access after successful Webex OAuth authentication.
Security Purpose: This provides organization-level access control, ensuring that only users from approved Webex organizations can view your gateway's monitoring dashboard, even if they have valid Webex credentials.
To authorize multiple organizations, use a comma-separated list of organization IDs:
# Preferred format (comma-separated, no spaces)
export AUTHORIZED_WEBEX_ORG_IDS="org-id-1,org-id-2,org-id-3"
# Also valid (with spaces - whitespace is automatically trimmed)
export AUTHORIZED_WEBEX_ORG_IDS="org-id-1, org-id-2, org-id-3"
# Also valid (spaces around commas are handled gracefully)
export AUTHORIZED_WEBEX_ORG_IDS="org-id-1 , org-id-2 , org-id-3"Examples with Real Organization IDs:
# Single organization
export AUTHORIZED_WEBEX_ORG_IDS="Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi8xMjM0NTY3OA"
# Multiple organizations
export AUTHORIZED_WEBEX_ORG_IDS="Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi8xMjM0NTY3OA,Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi85ODc2NTQzMjE"- Case Sensitive: Organization IDs are case-sensitive and must match exactly
- No Wildcards: You must list each organization ID explicitly - wildcards are not supported
- Comma Delimiter: Use commas (
,) to separate multiple IDs - other delimiters (semicolons, pipes, spaces) are not supported - Whitespace Handling: Leading and trailing whitespace around each ID is automatically removed
- Empty Values: Empty strings between commas are ignored (e.g.,
"org1,,org2"is treated as"org1,org2") - Required Variable: If authentication is enabled but this variable is empty or not set, all access will be denied
- User logs in with Webex OAuth
- Gateway extracts the user's organization ID from their access token
- Gateway checks if the organization ID exists in
AUTHORIZED_WEBEX_ORG_IDS - Access is granted only if the organization ID is found in the list
- If not found, the user sees "Your organization is not authorized to access this application"
- Maintain the List: Keep this list updated as organizations are added or removed
- Secure Storage: In production, store this in AWS Secrets Manager or similar secure storage
- Audit Access: Log all authorization attempts for security auditing
- Principle of Least Privilege: Only add organization IDs that absolutely need access
- Regular Review: Periodically review and remove organization IDs that no longer need access
- Review the main README for production deployment
- Check monitoring README for detailed auth flow
- Set up AWS Secrets Manager for production (see main README)
For issues or questions:
- Check the monitoring README troubleshooting section
- Review Webex OAuth documentation
- Create an issue in the repository