You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to get token so i can pass it to imap .Below is the sample code .However,I am getting accessToken and i am passing it to imap and it is returning authentication failed.
try {
//here i am getting access token and refreshtoken and
const accessToken = await client.getToken(tokenParams);
var xoauth2 = require("xoauth2"), xoauth2gen;
console.log('accesstoken', accessToken, accessToken.token.access_token);
xoauth2gen = xoauth2.createXOAuth2Generator({
user: "sathyakrishna2021@hotmail.com",
clientId: "282abac0-3xxxxx9",
clientSecret: "11w7Q~58UxxxxxxxxxxxxxxxxWBkWb.mPJOM1rgnI1a",
accessUrl :'https://login.live.com/oauth20_token.srf',
accessToken:accessToken.token.access_token,
customPayload: {
"access_type": "offline"
}
});
// Here i am getting token and i am passing this token to imap and it is returning authentication fail error
console.log("AUTH XOAUTH2 " + token);
let Imap = require('imap');
} catch (error) {
console.log('Access Token Error', error);
}
am i doing something wrong?
Could you please help me with this?
Waiting for your response.
Thanks
Azam Ahmed
The text was updated successfully, but these errors were encountered:
This library has been unmaintained for the last 7 years. Both Google and Microsoft have their own OAuth authentication libraries now, so there is no need for the xoauth2 library. When you create an application in Azure Directory then there is an option to download a sample Node.js application that shows you how to use their library. You could also check how other applications handle OAuth2 with Microsoft, eg you can find a tutorial for using it with EmailEngine here
@andris9 so there's no way to use node-imap library with the new Microsoft OAuth authentication?
My idea is to use their SDK to generate the token, then create the xoauth2 string and still use node-imap to get notified about new incoming emails.
@giacomobartoli I know nothing about the node-imap library. The only option I provide support for is https://emailengine.app/ - you can use it to listen for incoming emails with Microsoft accounts as well.
Hi,
I am trying to get token so i can pass it to imap .Below is the sample code .However,I am getting accessToken and i am passing it to imap and it is returning authentication failed.
try {
//here i am getting access token and refreshtoken and
const accessToken = await client.getToken(tokenParams);
var xoauth2 = require("xoauth2"), xoauth2gen;
console.log('accesstoken', accessToken, accessToken.token.access_token);
xoauth2gen = xoauth2.createXOAuth2Generator({
user: "sathyakrishna2021@hotmail.com",
clientId: "282abac0-3xxxxx9",
clientSecret: "11w7Q~58UxxxxxxxxxxxxxxxxWBkWb.mPJOM1rgnI1a",
accessUrl :'https://login.live.com/oauth20_token.srf',
accessToken:accessToken.token.access_token,
customPayload: {
"access_type": "offline"
}
});
// Here i am getting token and i am passing this token to imap and it is returning authentication fail error
console.log("AUTH XOAUTH2 " + token);
let Imap = require('imap');
});
imap.connect()
imap.once('ready', function() {
console.log('connectied')
imap.end();
});
imap.once('end', function() {
console.log('Connection ended');
});
});
} catch (error) {
console.log('Access Token Error', error);
}
am i doing something wrong?
Could you please help me with this?
Waiting for your response.
Thanks
Azam Ahmed
The text was updated successfully, but these errors were encountered: