Update API token handling for compatibility with 1.24