According to developer.yahoo.com/mail/ and IMAP responses:
* OK [CAPABILITY IMAP4rev1 ID MOVE NAMESPACE X-ID-ACLID UIDPLUS LITERAL+ CHILDREN XAPPLEPUSHSERVIC
you have to add scope=openid while hitting authorization endpoint, then after obtaining the token after hittng token endpoint, hit profile endpoint with the obtained access token, then we get emails under profile json object