whoami - Authentication Status
Overview
The whoami command displays your current authentication status and user information. It shows whether you’re authenticated, which authentication method you’re using, and your user details. This is useful for verifying authentication, troubleshooting access issues, and confirming which account you’re using.
Syntax
nmbl whoamiOutput
The command shows:
- Authentication status (authenticated or not)
- Authentication method (OAuth, license key, etc.)
- User information (email, name, etc.)
- Token expiry information (if applicable)
Examples
Check Authentication Status
nmbl whoamiShows current authentication details.
Verify After Login
# Login
nmbl login
# Verify it worked
nmbl whoamiConfirm successful authentication.
Check Before Running Commands
# Verify authentication first
nmbl whoami
# Then run authenticated command
nmbl cc src/Troubleshoot Authentication Issues
# Check current status
nmbl whoami
# If not authenticated, login
nmbl login
# Verify again
nmbl whoamiUse Cases
Initial Setup Verification
# After first install and login
dotnet tool install --global nmbl
nmbl login
nmbl whoamiConfirm authentication is configured correctly.
Multiple Account Management
# Check which account you're using
nmbl whoami
# If wrong account, switch
nmbl logout
nmbl login
nmbl whoamiCI/CD Debugging
# In a CI/CD script
nmbl whoami
# Shows if authentication is properly configuredTeam Collaboration
# When helping a teammate, ask them to run
nmbl whoami
# To diagnose authentication issuesPre-Flight Check
# Before starting work
nmbl whoami
nmbl --versionVerify your environment is properly configured.
Authentication States
Authenticated with OAuth
Authenticated: Yes
Method: OAuth (Google)
Email: user@example.com
Name: John Doe
Token Expires: 2024-12-31 23:59:59Authenticated with License Key
Authenticated: Yes
Method: License Key
Organization: Acme Corp
License Type: Team
License Expires: 2025-12-31Not Authenticated
Authenticated: No
Status: Please run 'nmbl login' to authenticateTroubleshooting
Shows “Not Authenticated”
If you expected to be authenticated:
# Try logging in
nmbl login
# Verify
nmbl whoamiShows Wrong Account
If the wrong account is shown:
# Logout
nmbl logout
# Login with correct account
nmbl login
# Verify
nmbl whoamiToken Expired
If token is expired:
# Re-authenticate
nmbl login
# Check new expiry
nmbl whoamiIntegration with Other Commands
Script Usage
#!/bin/bash
# Check authentication before running commands
if ! nmbl whoami | grep -q "Authenticated: Yes"; then
echo "Please authenticate first:"
nmbl login
exit 1
fi
# Proceed with commands
nmbl cc src/
nmbl deps MySolution.slnx --output deps.svgCI/CD Pipeline
# In GitHub Actions, Azure DevOps, etc.
steps:
- name: Check Authentication
run: nmbl whoami
- name: Run Analysis
run: nmbl cc src/Makefile Integration
.PHONY: check-auth analyze
check-auth:
@nmbl whoami | grep -q "Authenticated: Yes" || (echo "Please run: nmbl login" && exit 1)
analyze: check-auth
nmbl cc src/
nmbl cogc src/
nmbl todos src/
Best Practices
Include in Scripts
# Always check auth in automated scripts
nmbl whoami || exit 1Document for Team
# In team documentation:
# "Run 'nmbl whoami' to verify authentication"Regular Checks
# Periodically verify authentication
nmbl whoamiEnvironment Setup Scripts
#!/bin/bash
# setup-dev-env.sh
echo "Setting up development environment..."
# Check nmbl installation
if ! command -v nmbl &> /dev/null; then
echo "Installing nmbl..."
dotnet tool install --global nmbl
fi
# Check authentication
echo "Checking authentication..."
if ! nmbl whoami | grep -q "Authenticated: Yes"; then
echo "Please authenticate:"
nmbl login
fi
echo "Setup complete!"
nmbl whoamiRelated Commands
login- Authenticate with OAuthlogout- Clear authentication tokens- Authentication Guide - Detailed authentication documentation