Login to Office no longer working

Cool thank you very much!

In the mean time, where could I find the installer for Mac for previous version?

Here you go!
Release 1.9.2 · Foundry376/Mailspring (github.com)
Hope this will fix it in the meantime! Be sure to let me know if this resolve (temporarily) your issue by doing so!

Downgrading to 1.9.2 did resolve the problem. Looking forward to the fix. Cheers!

1 Like

Duplicate of Login to Office no longer working :+1:

Not sure if it helps, but I have tried a number of different email clients in the last few weeks, and for all of them, after logging in with OAuth It brings up a screen asking if I want to grant permissions to the app to “read and respond to emails” and such. Mailsrping is the only one that doesn’t have this screen requesting permissions. It’s also the only one that doesn’t work.

After the update, I also had this same issue (also Pro user). Reverting back to 1.9 resolved the issue.

I’m new with mailspring and i’d like to use it for my office 365 account.
I’m using the Flatpak version. I have the same issue.
The error mentioned was already solved here. I hope this helps.

Guys (dev team), this is a P1 issue, Mac version Version 1.10.2 (1.10.2) did not resolve this issue. Please address this, the behavior is painful. In which version do you expect to resolve this problem?

2 Likes

The only thing holding me back from canceling my subscription and install Newton is it require snapd on Linux.

Cancelled my subscription. I can’t upgrade because the OAuth doesn’t work in latest version. Can’t keep using the old version because it is a security risk.

Mailspring was a good idea. Just not enough demand to make it profitable. Thanks to the developers for your hard work.

1 Like

The proposed fix by F1nny above will not work because Origin is a reserved header name - the new value for the header supplied in fetch() will be ignored.

The electron way to fix this is to use .webRequest.onBeforeSendHeaders (https://stackoverflow.com/a/56376799). The fix is fairly simple and can be self-contained to the microsoft domain.

diff --git a/app/src/browser/main.js b/app/src/browser/main.js
index 57ce15fc0..0bf1000ef 100644
--- a/app/src/browser/main.js
+++ b/app/src/browser/main.js
@@ -324,6 +324,19 @@ const start = () => {
     app.removeListener('open-file', onOpenFileBeforeReady);
     app.removeListener('open-url', onOpenUrlBeforeReady);

+  const filter = {
+    urls: ["*://login.microsoftonline.com/*"]
+  };
+
+  session.defaultSession.webRequest.onBeforeSendHeaders(
+    filter,
+    (details, callback) => {
+      console.log(details);
+      details.requestHeaders['Origin'] = 'localhost';
+      callback({ requestHeaders: details.requestHeaders });
+    }
+  );
+
     // Block remote JS execution in a second way in case our <meta> tag approach
     // is compromised somehow https://www.electronjs.org/docs/tutorial/security
     // This CSP string should match the one in app/static/index.html

Whoops sorry double post there (replied to wrong comment)
Thanks @greg2010 - Yea I did get my build env fixed thismorning and was a no go when tried, that would be why! I tested the above and can confirm it works :+1:

2 Likes

@greg2010 We will be happy, of you open a pull request on GitHub to submit the fix. That would be really appreciated.

1 Like

I just had the time to try this out. After the change mentioned by @greg2010, I needed to replace the email field with userPrincipalName when parsing the response.

Unfortunately, this leads to some problems in the mailsync engine with the following error message:

{
    "debuginfo": "https://login.microsoftonline.com/common/oauth2/v2.0/token RETURNED {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided resource value for the input parameter 'scope' is not valid.\\\\r\\\\nTrace ID: 85180096-6ab4-4e6c-9f8d-a10c4fdd6002\\\\r\\\\nCorrelation ID: fe13e5a2-5aa8-4937-923f-45bfdb4caaf8\\\\r\\\\nTimestamp: 2022-04-08 13: 37: 12Z\\",\\"error_codes\\":[70011],\\"timestamp\\":\\"2022-04-08 13: 37: 12Z\\",\\"trace_id\\":\\"85180096-6ab4-4e6c-9f8d-a10c4fdd6002\\",\\"correlation_id\\":\\"fe13e5a2-5aa8-4937-923f-45bfdb4caaf8\\"}",
    "key": "Invalid Response Code: 400",
    "retryable": true,
    "what": "std::exception"
}

Weird - what made you have to replace the email field with UPN?
I’m running that change as-is (though it’s also on top of the prior change I tried but that’s N/A as gets dropped as we found out, ha) and everything has seemed to be working great :thinking:

When are we users getting the fix? Same problem for me.

When I look at the OAuth response, the e-mail field is empty for me. I have created a free O365 e-mail account for testing. Maybe this is the issue? The response looks like:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "displayName": "Firstname Lastname",
    "surname": "Lastname",
    "givenName": "Firstname",
    "id": "cd6008dfbb81d326",
    "userPrincipalName": "myemail@outlook.de",
    "businessPhones": [],
    "jobTitle": null,
    "mail": null,
    "mobilePhone": null,
    "officeLocation": null,
    "preferredLanguage": null
}

As you can see, the e-mail field is null in my case for whatever reason.

However, I am able to add the e-mail account as an “Outlook.com / Hotmail” account. I am not sure, what / how exactly they differenciate and how I can create a “real” O365 e-mail account for testing.

Ahhhh yea that’s likely why, Outlook is considered separate from O365 (stupid microsoft - O365 structure is SUPER convoluted).

O365 is traditionally the hosted Exchange plans far as I’ve seen. Though I THINK the Home/Personal O365 plans also work as O365? Not as sure on that part since those ones get branded Outlook instead of O365.

You can sign up for a free trial of the basic O365 plan via https://www.microsoft.com/en-us/microsoft-365/business/compare-all-microsoft-365-business-products otherwise if that’s too much trouble I may be able to help getcha a temporary O365 account for testing purposes :+1:

I agree, that everything Microsoft Login related is crazy. I did not understand that the private O365 is actually not O356…
Thanks for the link to the real one. I will see if I get the time to set up a test account and check if works with the “business” O365 account.

I can confirm that it works with a “real” O365 account and created a Pull Request to resolve the issue: https://github.com/Foundry376/Mailspring/pull/2390

Thanks for all the help debugging and resolving this issue, especially to @F1nny and @greg2010

3 Likes