2345联盟安装系统,2345系统安装,2345联盟推广,2345系统下载,2345一键安装,2345联盟官网,2345系统重装,2345联盟注册,2345系统ISO,2345联盟赚钱,2345系统纯净版,2345联盟代理,2345系统安装教程,2345联盟任务,2345系统GHOST,2345联盟提现,2345系统激活,2345联盟作弊,2345系统兼容,2345联盟软件,2345系统优化,2345联盟平台,2345系统64位,2345联盟合作,2345系统安装包,2345联盟返利,2345系统正版,2345联盟推广方法,2345系统U盘安装,2345联盟佣金,2345系统驱动,2345联盟规则,2345系统PE安装,2345联盟账号,2345系统备份,2345联盟体验,2345系统安全,2345联盟教程,2345系统定制,2345联盟审核,2345系统更新,2345联盟收益,2345系统版本,2345联盟玩法,2345系统装机,2345联盟策略,2345系统镜像,2345联盟工具,2345系统硬盘安装,2345联盟评价,2345系统使用,2345联盟常见问题,2345系统修复,2345联盟经验,2345系统启动盘,2345联盟优缺点,2345系统卸载,2345联盟数据,2345系统破解,2345联盟合规,2345系统封装,2345联盟技巧,2345系统设置,2345联盟骗局,2345系统还原,2345联盟真实性,2345系统速度,2345联盟心得,2345系统内存,2345联盟流程,2345系统错误,2345联盟风险,2345系统蓝屏,2345联盟免责,2345系统安装失败,2345联盟客服,2345系统帮助,2345联盟反馈,2345系统推荐,2345联盟口碑,2345系统评测,2345联盟对比,2345系统性能,2345联盟总结,2345系统最新版,2345联盟2026,2345系统安装步骤,2345联盟SEO,2345系统关键词,2345联盟排名,2345系统搜索,2345联盟引流,2345系统优化技巧,2345联盟流量,2345系统装机量,2345联盟转化率,2345系统用户评价,2345联盟成功率,2345系统安装时长,2345联盟收益截图,2345系统兼容性,2345联盟操作,2345系统自动安装,2345联盟心得分享,2345系统静默安装,2345联盟实战,2345系统无人值守,2345联盟经验分享,2345系统快速安装,2345联盟教程大全,2345系统安装问题,2345联盟解决方案 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

Authentication Failure for IMAP and POP3 using Client Credential flow for OAuth2.0

发布时间:2026-09-17 | 浏览:1
📥 下载地址(文章开头)
电脑助手解决一切电脑问题。
Forum Discussion I am facing an authentication failure issue while trying to connect for both IMAP and POP3 protocols using the Client Credential Grant flow for OAuth2.0 Where, I have been following the steps suggested in "https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#get-an-access-token" I have been using this github project to fetch the Access Token using Client Credential Grant flow: https://github.com/Azure-Samples/ms-identity-msal-java-samples/tree/main/1.%20Server-Side%20Scenarios/msal-client-credential-secret Java Code for IMAP : Java code for POP3 : Following are the credentials which I have used while performing the Client Credential Grant flow userEmail :- Email of the user which is used to login to Azure portal (eg, email address removed for privacy reasons) authority =https://login.microsoftonline.com/ <tenant - id - here> / client_id = <client(application) - id - here> secret = <client - secret - key - here> scope = https://outlook.office.com/.default Below Image contains list of permissions I have applied in my app: DEBUG: JavaMail version 1.5.6 DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: setDebug: JavaMail version 1.5.6 DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle] DEBUG IMAP: mail.imap.fetchsize: 16384 DEBUG IMAP: mail.imap.ignorebodystructuresize: false DEBUG IMAP: mail.imap.statuscachetimeout: 1000 DEBUG IMAP: mail.imap.appendbuffersize: -1 DEBUG IMAP: mail.imap.minidletime: 10 DEBUG IMAP: enable STARTTLS DEBUG IMAP: enable SASL DEBUG IMAP: SASL mechanisms allowed: XOAUTH2 DEBUG IMAP: closeFoldersOnStoreFailure DEBUG IMAP: trying to connect to host "outlook.office365.com", port 993, isSSL true * OK The Microsoft Exchange IMAP4 service is ready. [UABOADMAU...<token_value>] A0 CAPABILITY * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+ A0 OK CAPABILITY completed. DEBUG IMAP: AUTH: PLAIN DEBUG IMAP: AUTH: XOAUTH2 DEBUG IMAP: protocolConnect login, host=outlook.office365.com, user=email address removed for privacy reasons, password=<non-null> DEBUG IMAP: SASL Mechanisms: DEBUG IMAP: XOAUTH2 DEBUG IMAP: DEBUG IMAP: SASL client XOAUTH2 DEBUG IMAP: SASL callback length: 2 DEBUG IMAP: SASL callback 0: javax.security.auth.callback.NameCallback@73f9ac DEBUG IMAP: SASL callback 1: javax.security.auth.callback.PasswordCallback@1064425 A1 AUTHENTICATE XOAUTH2 dXNlc...<token-value-here> A1 NO AUTHENTICATE failed. javax.mail.AuthenticationFailedException: AUTHENTICATE failed. at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:725) at javax.mail.Service.connect(Service.java:366) at javax.mail.Service.connect(Service.java:246) at test.ClientCredentialGrantAndConnect.connectIMAP(ClientCredentialGrantAndConnect.java:166) at test.ClientCredentialGrantAndConnect.main(ClientCredentialGrantAndConnect.java:45) DEBUG: JavaMail version 1.5.6 DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: setDebug: JavaMail version 1.5.6 DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle] DEBUG POP3: mail.pop3.rsetbeforequit: false DEBUG POP3: mail.pop3.disabletop: false DEBUG POP3: mail.pop3.forgettopheaders: true DEBUG POP3: mail.pop3.cachewriteto: false DEBUG POP3: mail.pop3.filecache.enable: false DEBUG POP3: mail.pop3.keepmessagecontent: false DEBUG POP3: mail.pop3.starttls.enable: true DEBUG POP3: mail.pop3.starttls.required: true DEBUG POP3: mail.pop3.finalizecleanclose: false DEBUG POP3: mail.pop3.apop.enable: false DEBUG POP3: mail.pop3.disablecapa: false DEBUG POP3: connecting to host "outlook.office365.com", port 995, isSSL false javax.mail.AuthenticationFailedException: Read timed out at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:213) at javax.mail.Service.connect(Service.java:366) at javax.mail.Service.connect(Service.java:246) at test.ClientCredentialGrantAndConnect.connectPOP(ClientCredentialGrantAndConnect.java:209) at test.ClientCredentialGrantAndConnect.main(ClientCredentialGrantAndConnect.java:50) Following is the list of jars I have used as a part of this development: My Java Code Link(ideone): https://ideone.com/2RaWN9
📥 下载地址(文章中间)
电脑助手解决一切电脑问题。
Please help and let me know if the program is not correct. Or if any important step seems to be missing. borist2 Jul 29, 2022 Hi. I had the same problem, but I think I made some progress. I read documentation few times, tried few times from the start with same error. I even have tried using client and object ids instead of email as username, in lack of better ideas. So this is where I think I have made mistake previous times. When you are at the part that you need to register service principal, you need to execute New-ServicePrincipal -AppId <APPLICATION_ID> -ServiceId <OBJECT_ID> [-Organization <ORGANIZATION_ID>] here I put enterprise application object id as ServiceId argument. And that is ok. But on Add-MailboxPermission -Identity "email address removed for privacy reasons" -User <SERVICE_PRINCIPAL_ID> -AccessRights FullAccess I have put my registered application object id as User argument. I also tried setting object id of enterprise application, but it did not have success. I also tried New-ServicePrincipal but with registered app object id as service id, but it gave me the same result. When I executed Get-ServicePrincipal -Organization <ORGANIZATION_ID> | fl I did not pay attention to ServiceId property, even with documentation specifying it and saying it will be different. Now I cleared everything and started fresh. I executed all the steps again, but on the step when I need to add mail permission, I list service principals, and then use `ServiceId` value from the output, as argument for user. With that, I was able to authorise. Unfortunately, now I receive `C3 BAD User is authenticated but not connected.` when I try to list inbox. But it is step forward. I am not sure if you made the same error as me, but maybe it will help you in some way. I will post info, when I find fix for the new error if somebody comes across same issue. Marked as Solution Hi. I had the same problem, but I think I made some progress. I read documentation few times, tried few times from the start with same error. I even have tried using client and object ids instead of email as username, in lack of better ideas. So this is where I think I have made mistake previous times. When you are at the part that you need to register service principal, you need to execute here I put enterprise application object id as ServiceId argument. And that is ok. I have put my registered application object id as User argument. I also tried setting object id of enterprise application, but it did not have success. I also tried New-ServicePrincipal but with registered app object id as service id, but it gave me the same result. When I executed I did not pay attention to ServiceId property, even with documentation specifying it and saying it will be different. Now I cleared everything and started fresh. I executed all the steps again, but on the step when I need to add mail permission, I list service principals, and then use `ServiceId` value from the output, as argument for user. With that, I was able to authorise. Unfortunately, now I receive `C3 BAD User is authenticated but not connected.` when I try to list inbox. But it is step forward. I am not sure if you made the same error as me, but maybe it will help you in some way. I will post info, when I find fix for the new error if somebody comes across same issue.
📥 下载地址(文章结尾)
电脑助手解决一切电脑问题。