Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/src/bin/gmail_oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ async fn main() -> Result<()> {
let tls_stream = tls.connect(domain, tcp_stream).await?;
let client = async_imap::Client::new(tls_stream);

// Gmail's IMAP server will send a server greeting before taking in any message
// Here, we forcefully wait and read a line before sending authentication data
//
// See #84
let _greeting = client
.read_response()
.await?
.expect("unexpected end of stream, expected greeting");

let mut imap_session = match client.authenticate("XOAUTH2", &gmail_auth).await {
Ok(c) => c,
Err((e, _unauth_client)) => {
Expand Down