I'm using Spring integration mail for imap idle events. I want to implement a IMAP gmail client using the token instead of using username and password.
Is Spring Integration Mail IMAP able to connect to gmail store with access token?
Here's the code I used
IntegrationFlow flow = IntegrationFlows
.from(Mail.imapIdleAdapter("imaps://[username]:[password]@imap.gmail.com:993/inbox")
.javaMailProperties(p -> p
.put("mail.debug", "false")
.autoStartup(false)
.shouldReconnectAutomatically(true)
.userFlag("testSIUserFlag")
.headerMapper(new DefaultMailHeaderMapper()))
.handle((Message<?> message) -> {
logger.info("message: " + message);
})
.get();