首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mutt & mutt_oauth.py - mutt_account_getoauthbearer:命令返回空字符串

mutt & mutt_oauth.py - mutt_account_getoauthbearer:命令返回空字符串
EN

Unix & Linux用户
提问于 2022-10-19 18:00:08
回答 1查看 222关注 0票数 1

我试图设置一个Exchange 365电子邮件帐户的Mutt终端电子邮件客户端。我使用mutt_oauth.py是为了方便OAuth流。

我遵循了自述文件中的说明,但遇到了一个问题。当我加载mutt时,它尝试登录,但返回以下错误:

代码语言:javascript
复制
mutt_account_getoauthbearer: Command returned empty string

下面是mutt -d 5的输出:

代码语言:javascript
复制
[2022-10-19 13:49:59] Mutt/2.2.7 (2022-08-07) debugging at level 5
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] Reading configuration file '/opt/homebrew/Cellar/mutt/2.2.7/etc/Muttrc'.
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9e90, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added */.* [9]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added text/x-vcard [7]
[2022-10-19 13:49:59] parse_attach_list: added application/pgp.* [2]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x600001d588d0
[2022-10-19 13:49:59] parse_attach_list: skipping text/x-vcard
[2022-10-19 13:49:59] parse_attach_list: skipping application/pgp.*
[2022-10-19 13:49:59] parse_attach_list: added application/x-pkcs7-.* [2]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047ca300, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added text/plain [7]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x600001d588d0
[2022-10-19 13:49:59] parse_attach_list: skipping text/x-vcard
[2022-10-19 13:49:59] parse_attach_list: skipping application/pgp.*
[2022-10-19 13:49:59] parse_attach_list: skipping application/x-pkcs7-.*
[2022-10-19 13:49:59] parse_attach_list: added message/external-body [4]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047ca308, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added message/external-body [4]
[2022-10-19 13:49:59] Reading configuration file '/Users/jlcarveth/.mutt/muttrc'.
[2022-10-19 13:49:59] Using default IMAP port 143
[2022-10-19 13:49:59] Using default IMAPS port 993
[2022-10-19 13:49:59] Setting $hostname
[2022-10-19 13:49:59] getdnsdomainname(): localdomain
[2022-10-19 13:49:59] $hostname set to "JLCM2.localdomain"
[2022-10-19 13:49:59] Reading imap://outlook.office365.com/INBOX...
[2022-10-19 13:49:59] Looking up outlook.office365.com...
[2022-10-19 13:49:59] Connecting to outlook.office365.com...
[2022-10-19 13:49:59] Connected to outlook.office365.com:143 on fd=7
[2022-10-19 13:49:59] imap_cmd_step: grew buffer to 512 bytes
[2022-10-19 13:49:59] 7< * OK The Microsoft Exchange IMAP4 service is ready. [***OMITTED***]
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] 7> a0000 CAPABILITY
[2022-10-19 13:49:59] 7< * CAPABILITY IMAP4 IMAP4rev1 LOGINDISABLED STARTTLS SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
[2022-10-19 13:49:59] Handling CAPABILITY
[2022-10-19 13:49:59] 7< a0000 OK CAPABILITY completed.
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] 7> a0001 STARTTLS
[2022-10-19 13:49:59] 7< a0001 OK Begin TLS negotiation now.
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] ssl_load_certificates: loading trusted certificates
[2022-10-19 13:49:59] mutt_ssl_starttls: Error loading trusted certificates
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/O=DigiCert Inc/CN=DigiCert Cloud Services CA-1 (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=outlook.com (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: hostname check passed
[2022-10-19 13:49:59] TLSv1.2 connection using TLSv1.2 (ECDHE-RSA-AES256-GCM-SHA384)
[2022-10-19 13:50:00] 7> a0002 CAPABILITY
[2022-10-19 13:50:00] 7< * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
[2022-10-19 13:50:00] Handling CAPABILITY
[2022-10-19 13:50:00] 7< a0002 OK CAPABILITY completed.
[2022-10-19 13:50:00] IMAP queue drained
[2022-10-19 13:50:00] imap_authenticate: Trying method oauthbearer
[2022-10-19 13:50:00] SASL local ip: 192.168.1.248;55042, remote ip:52.96.88.162;143
[2022-10-19 13:50:00] External SSF: 256
[2022-10-19 13:50:00] mutt_sasl_cb_authname: getting user for outlook.office365.com:143
[2022-10-19 13:50:00] imap_auth_sasl: oauthbearer unavailable
[2022-10-19 13:50:00] imap_authenticate: Trying method xoauth2
[2022-10-19 13:50:00] Authenticating (XOAUTH2)...
[2022-10-19 13:50:00] mutt_account_getoauthbearer: Command returned empty string
[2022-10-19 13:50:02] mutt_index_menu[827]: Got op 99
[2022-10-19 13:50:02] q: unknown command
[2022-10-19 13:50:03] mutt_index_menu[827]: Got op 177
[2022-10-19 13:50:03] Closing connection to outlook.office365.com...
[2022-10-19 13:50:03] 7> a0003 LOGOUT
[2022-10-19 13:50:03] 7< * BYE Microsoft Exchange Server IMAP4 server signing off.
[2022-10-19 13:50:03] Handling BYE
[2022-10-19 13:50:03] 7< a0003 OK LOGOUT completed.
[2022-10-19 13:50:03] IMAP queue drained
[2022-10-19 13:50:03] mutt_buffer_pool_free: 10 of 10 returned to pool

我不知道如何解决这个错误。当我运行python3 mutt_oauth.py my@email.com.tokens --verbose --test时,我的令牌似乎是有效的,因为标记是打印出来的,没有问题。

我的~/.mutt/muttrc非常简单:

代码语言:javascript
复制
set imap_user="***OMITTED***"
set folder="imap://outlook.office365.com/"
#set imap_pass='***OMITTED***'
set smtp_url = "smtp://${imap_user}@smtp.office365.com:587/"
set imap_authenticators="oauthbearer:xoauth2"
set imap_oauth_refresh_command="/Users/jlcarveth/mutt_oauth.py \
    --quiet ${imap_user}.tokens"
set smtp_authenticators='${imap_authenticators}'
set smtp_oauth_refresh_command=${imap_oauth_refresh_command}
set spoolfile=+INBOX

# Store message headers locally to speed things up
set header_cache=~/.cache/mutt
set message_cachedir=~/.cache/mutt

# Allow mutt to open an IMAP connection passively
unset imap_passive

set imap_keepalive = 300

杂种狗诉2.2.7

EN

回答 1

Unix & Linux用户

发布于 2022-12-04 01:05:12

这条线在这里

代码语言:javascript
复制
set imap_oauth_refresh_command="/Users/jlcarveth/mutt_oauth.py \
--quiet ${imap_user}.tokens"

${imap_user}.tokens不是一条无路可走的路。我猜这是你的问题。尝试将完整的路径添加到令牌文件中。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/721649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档