Cosmos Explorer error if login expires and MFA is required
- Dominant language
- TypeScript
- Stars
- 131
- Forks
- 67
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 10
Description
If I've been logged into an account for long enough that I require re-authentication, Cosmos Explorer will be unable to deal with this.
Running after a weekend off, before being asked to do MFA auth anywhere else gives this error when I click sign-in:

The console shows a 400 Bad Request:
```
XHRPOST
https://login.microsoftonline.com/425a5546-5a6e-4f1b-ab62-23d91d07d893/oauth2/v2.0/token
[HTTP/1.1 400 Bad Request 117ms]
error "invalid_grant"
error_description "AADSTS50078: Presented multi-factor authentication has expired due to policies configured by your administrator, you must refresh your multi-factor authentication to access ''. Trace ID: 97c57a27-e2f6-4dde-82e1-d6870bd53600 Correlation ID: b833dfaa-44bd-42a2-9c7c-db92080afa48 Timestamp: 2024-01-29 09:46:19Z"
error_codes [ 50078 ]
0 50078
timestamp "2024-01-29 09:46:19Z"
trace_id "97c57a27-e2f6-4dde-82e1-d6870bd53600"
correlation_id "b833dfaa-44bd-42a2-9c7c-db92080afa48"
suberror "basic_action"
```
If I'm using `cosmos.azure.com` instead, I (obviously) don't get any popups. The message is still in the console, and "Switch Directory" will reveal a blank side panel without either my home tenant or any alternative directories. "Select a Database Account" will not show subscription choices (or inform you that there are no subscriptions).
Contributor guide
Research direction
Start by reproducing the expired-MFA sign-in flow and inspect the failed OAuth token request to login.microsoftonline.com. Check the Sign in, Switch Directory, and Select a Database Account entry points; done means expired MFA prompts for re-authentication and the tenant, directory, and subscription choices populate normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100