Android应用ADAL登录Office 365遇SERVER_ERROR:201问题排查
Hey there, let's break this down clearly for you. That SERVER_ERROR:201 you're seeing when logging in with your personal Office 365 account—while other accounts work fine—strongly points to an issue tied specifically to your account, rather than your app's ADAL configuration or code. Here's why, plus steps to confirm and resolve:
Why Your Account Is Likely the Culprit
Since other Office 365 accounts authenticate successfully with the same app setup, we can rule out:
- Misconfigured app registration in Azure AD
- Bugs in your authentication code logic
- General issues with the ADAL 1.13.1 library (since it works for other users)
Instead, the problem is almost certainly related to your specific account's state or settings:
- Account security restrictions: Microsoft's systems might have temporarily locked your account due to unusual login activity, or you might have pending MFA verification steps that aren't being properly handled by the older ADAL library.
- Account activation or compliance issues: Even personal accounts can have activation requirements (e.g., verifying your email/phone) that haven't been completed, or hidden compliance flags triggered by Microsoft's security systems.
- Corrupted local cache: While less likely, your app might have stored corrupted authentication tokens for this specific account, causing the server error during re-authentication.
Steps to Confirm & Fix
Verify account access via web browser
Try logging into your Office 365 account (e.g., Outlook.com, Office.com) using a web browser. If you encounter errors, prompts for verification, or account locks here, that confirms the issue is with your account itself—reach out to Microsoft support to resolve it.
Clear app cache and data
- On your Android device, go to Settings > Apps > [Your App] > Storage
- Tap "Clear Cache" and "Clear Data"
- Restart the app and attempt to log in with the problematic account again. This eliminates any corrupted local token data that might be causing the error.
Test the account on another device/app
- Try logging into the same account using another Android app that uses ADAL, or even on a different device. If you get the same
SERVER_ERROR:201, this confirms the account is the root cause. If it works elsewhere, the issue might be isolated to your device's local setup (though this is unlikely given other accounts work).
- Try logging into the same account using another Android app that uses ADAL, or even on a different device. If you get the same
Consider updating ADAL (or migrating to MSAL)
ADAL 1.13.1 is a fairly outdated version—Microsoft has deprecated ADAL in favor of MSAL (Microsoft Authentication Library). While this isn't the most likely fix here, updating to the latest ADAL version (or migrating to MSAL) might resolve edge-case compatibility issues with certain personal accounts.
Final Takeaway
Given that other accounts work seamlessly with your app, the most probable cause is an issue with your specific Office 365 account. Start with the web login check and cache clearing steps—those will help you confirm the issue quickly.
内容的提问来源于stack exchange,提问作者user4166057

