Skip to content

Power Automate Auth Failure

Symptom

slurm-powerautomate.service fails shortly after starting:

sudo systemctl status slurm-powerautomate.service
systemctl status output
× slurm-powerautomate.service - SLURM PowerAutomate Account Processor
     Loaded: loaded (/etc/systemd/system/slurm-powerautomate.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2025-12-11 10:00:05 +03; 30s ago
TriggeredBy: ● slurm-powerautomate.timer
    Process: 2331932 ExecStart=/opt/anaconda3/bin/python /opt/slurm-powerautomate/slurm_main.py --both (code=exited, status=1/FAILURE)
   Main PID: 2331932 (code=exited, status=1/FAILURE)
        CPU: 206ms

Dec 11 10:00:00 server02 python[2331932]: 2025-12-11 10:00:00,597 - INFO - PHASE 1: Authentication & Data Loading
Dec 11 10:00:05 server02 python[2331932]: 2025-12-11 10:00:05,421 - ERROR - Authentication error: argument of type 'NoneType' is not iterable
Dec 11 10:00:05 server02 python[2331932]: 2025-12-11 10:00:05,421 - ERROR - Failed to authenticate with OneDrive
Dec 11 10:00:05 server02 python[2331932]: 2025-12-11 10:00:05,422 - INFO - LDAP connection closed
Dec 11 10:00:05 server02 systemd[1]: slurm-powerautomate.service: Main process exited, code=exited, status=1/FAILURE

Cause

The cached MSAL OAuth token used to authenticate against OneDrive/Microsoft Graph (see Automatic Provisioning) has expired. The automated systemd service runs non-interactively, so it can't complete a fresh OAuth login itself once the cached token stops working — it just fails authentication every time the timer fires.

Fix

  1. Remove the stale token cache:

    sudo rm /opt/slurm-powerautomate/.msal_token_cache.json
    
  2. Run the script manually to complete a fresh interactive login:

    sudo /opt/anaconda3/bin/python /opt/slurm-powerautomate/slurm_main.py --both
    

    This re-authenticates interactively and writes a new token cache. Once it succeeds, the automated slurm-powerautomate.service/.timer will work again using the renewed cache.