Hello, I want to connect to GMail using JavaMail 1.5.2<https://java.net/projects/javamail/downloads>. I have two kind of clients: for one hand, there're clients who use OAuth 2.0 2-legged (service account) and they connect to GMail and they can get the messages fine. For another hand, there're clients who use OAuth 2.0 3-legged (normal identification). I can't connect with them to GMail.
The Java code that I'm using to connect is: Properties props = new Properties(); props.put("mail.imap.ssl.enable", "true"); props.put("mail.imap.sasl.enable", "true"); props.put("mail.imap.sasl.mechanisms", "XOAUTH2"); props.put("mail.imap.auth.login.disable", "true"); props.put("mail.imap.auth.plain.disable", "true"); Session session = Session.getInstance(props); Store store = session.getStore("imap"); store.connect("imap.gmail.com", *email*, *access_token*); When I try this code, my debug says: DEBUG: setDebug: JavaMail version 1.5.2 DEBUG IMAPS: mail.imap.fetchsize: 16384 DEBUG IMAPS: mail.imap.ignorebodystructuresize: false DEBUG IMAPS: mail.imap.statuscachetimeout: 1000 DEBUG IMAPS: mail.imap.appendbuffersize: -1 DEBUG IMAPS: mail.imap.minidletime: 10 DEBUG IMAPS: enable SASL DEBUG IMAPS: SASL mechanisms allowed: XOAUTH2 DEBUG IMAPS: trying to connect to host "imap.gmail.com", port 993, isSSL true * OK Gimap ready for requests from XX.XX.XX.XX pg7mb36974204wic A0 CAPABILITY * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN A0 OK Thats all she wrote! pg7mb36974204wic DEBUG IMAPS: AUTH: XOAUTH DEBUG IMAPS: AUTH: XOAUTH2 DEBUG IMAPS: AUTH: PLAIN DEBUG IMAPS: AUTH: PLAIN-CLIENTTOKEN DEBUG IMAPS: protocolConnect login, host=imap.gmail.com, user=MY_EMAILs, password=<non-null> DEBUG IMAPS: SASL authentication command trace suppressed DEBUG IMAPS: SASL Mechanisms: DEBUG IMAPS: XOAUTH2 DEBUG IMAPS: DEBUG IMAPS: SASL client XOAUTH2 DEBUG IMAPS: SASL callback length: 1 DEBUG IMAPS: SASL callback 0: javax.security.auth.callback.NameCallback@138bef5 *DEBUG IMAPS: SASL no response* Well, I don't know what happens but it has to be because of OAuth 2.0 because I have tried to connect to GMail without OAuth 2.0 (using email and password) and it works fine. Any idea? -- *___Nota:* Según la normativa vigente en materia de Protección de Datos de Carácter Personal, le informamos que sus datos han sido incorporados a un fichero denominado "Clientes y/o Proveedores" creado por resolución de la Agencia Española de Protección de Datos y del que es responsable "*The Cloud Gate S.L.*", con CIF: B-18961433. La finalidad del tratamiento de sus datos es mantener la relación contractual existente o mantenerle informado de novedades y noticias que puedan resultar de su interés. Le informamos que usted puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición, mediante escrito dirigido a: "*The Cloud Gate S.L.*", Avda. Constitución 22, 1º 8 - 18012 Granada, o mediante email a la siguiente dirección de correo electrónico: i...@thecloud.es La información incluida en este e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario arriba mencionado. Si usted lee este mensaje y no es el destinatario indicado, le informamos que está totalmente prohibida cualquier utilización, divulgación, distribución y/o reproducción de esta comunicación sin autorización expresa en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos nos lo notifique inmediatamente por esta misma vía y proceda a su eliminación. *"**nubbius"*es una marca registrada por The Cloud Gate S.L. This information is private and confidential and intended for the recipient only. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an official statement from *The Cloud Gate, S.L.* Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. "*nubbius*" is a registered trademark of The Cloud Gate S.L. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.