mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-27 19:07:15 +08:00
Fix login to Office 365 Accounts
This commit is contained in:
parent
25e098f394
commit
9606f547fa
2 changed files with 16 additions and 1 deletions
|
@ -32,7 +32,7 @@ const O365_SCOPES = [
|
|||
'Calendars.ReadWrite', // calendar
|
||||
'Calendars.ReadWrite.Shared', // calendar
|
||||
|
||||
// Future note: When you exchane the refresh token for an access token, you may
|
||||
// Future note: When you exchange the refresh token for an access token, you may
|
||||
// request these two OR the above set but NOT BOTH, because Microsoft has mapped
|
||||
// two underlying systems with different tokens onto the single flow and you
|
||||
// need to get an outlook token and not a Micrsosoft Graph token to use these APIs.
|
||||
|
|
|
@ -324,6 +324,21 @@ const start = () => {
|
|||
app.removeListener('open-file', onOpenFileBeforeReady);
|
||||
app.removeListener('open-url', onOpenUrlBeforeReady);
|
||||
|
||||
// Setting the Origin Header to 'localhost' when logging in on Office 365
|
||||
// Otherwise O365 will produce a 400 error on the OAuth Login Process
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue