How to select the correct authentication flow?