-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aerc-accounts: improve logic for parsing XOAUTH2 URL params (#6530)
This commit fixes an issue in aerc-accounts that prevents oauth2 accounts from being generated from given parameters. It also allows users to add XOAUTH2 credentials without having to add all four of client_id, client_secret, token_endpoint, and scope. It further adds tests for the XOAUTH2 config generation.
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Generated by Home Manager. | ||
|
||
[basic] | ||
copy-to = Sent | ||
default = Inbox | ||
from = Annie X. Hacker <anniex@mail.invalid> | ||
outgoing = smtp+xoauth2://anniex@smtp.office365.com:587?client_id=9e5f94bc-e8a4-4e73-b8be-63364c29d753&token_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fv2.0%2Ftoken | ||
postpone = Drafts | ||
source = imaps+xoauth2://anniex@outlook.office365.com:993?client_id=9e5f94bc-e8a4-4e73-b8be-63364c29d753&token_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fv2.0%2Ftoken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ config, pkgs, ... }: { | ||
config = { | ||
nmt.script = let | ||
dir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then | ||
"home-files/Library/Preferences/aerc" | ||
else | ||
"home-files/.config/aerc"; | ||
in '' | ||
assertFileContent ${dir}/accounts.conf ${./oauth.expected} | ||
''; | ||
programs.aerc = { | ||
enable = true; | ||
extraConfig.general.unsafe-accounts-conf = true; | ||
}; | ||
|
||
accounts.email.accounts = { | ||
basic = { | ||
realName = "Annie X. Hacker"; | ||
userName = "anniex"; | ||
address = "anniex@mail.invalid"; | ||
primary = true; | ||
flavor = "outlook.office365.com"; | ||
|
||
aerc = rec { | ||
enable = true; | ||
imapAuth = "xoauth2"; | ||
smtpAuth = imapAuth; | ||
imapOauth2Params = { | ||
client_id = "9e5f94bc-e8a4-4e73-b8be-63364c29d753"; | ||
token_endpoint = | ||
"https://login.microsoftonline.com/common/oauth2/v2.0/token"; | ||
}; | ||
smtpOauth2Params = imapOauth2Params; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} | ||
|