Not able to send mails using Nodemailer and access tokens obtained from GmailUse OAuth Refresh Token to Obtain New Access Token - Google APIHow to obtain access-token for a RAML API using OAuth 2.0Why is OAuth2 with Gmail Nodejs Nodemailer producing “Username and Password not accepted” errorGet Google access token expiration time in AndroidGet user access tokens and authenticate requestNodemailer XOauth2 [Error: unauthorized_client] when trying to get new access tokenTOAuth2Authenticator: How do i refresh an expired token?Gmail, nodemailer, OATH2 refresh token not workingGoogle OAuth 2 access token not working as expected some hours after authorizingHow to implement auto refresh token in graphql for jwt based authentication?

How long after the last departure shall the airport stay open for an emergency return?

Is Diceware more secure than a long passphrase?

How can I get rid of an unhelpful parallel branch when unpivoting a single row?

Mistake in years of experience in resume?

std::unique_ptr of base class holding reference of derived class does not show warning in gcc compiler while naked pointer shows it. Why?

Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?

Why must Chinese maps be obfuscated?

Could moose/elk survive in the Amazon forest?

Is there any pythonic way to find average of specific tuple elements in array?

How to be good at coming up with counter example in Topology

Is there metaphorical meaning of "aus der Haft entlassen"?

Can a Bard use the Spell Glyph option of the Glyph of Warding spell and cast a known spell into the glyph?

How do I check if a string is entirely made of the same substring?

Von Neumann Extractor - Which bit is retained?

Is Electric Central Heating worth it if using Solar Panels?

Why do games have consumables?

What is this word supposed to be?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Extracting Dirichlet series coefficients

How can I practically buy stocks?

Find a stone which is not the lightest one

What was Apollo 13's "Little Jolt" after MECO?

Why do distances seem to matter in the Foundation world?

Older movie/show about humans on derelict alien warship which refuels by passing through a star



Not able to send mails using Nodemailer and access tokens obtained from Gmail


Use OAuth Refresh Token to Obtain New Access Token - Google APIHow to obtain access-token for a RAML API using OAuth 2.0Why is OAuth2 with Gmail Nodejs Nodemailer producing “Username and Password not accepted” errorGet Google access token expiration time in AndroidGet user access tokens and authenticate requestNodemailer XOauth2 [Error: unauthorized_client] when trying to get new access tokenTOAuth2Authenticator: How do i refresh an expired token?Gmail, nodemailer, OATH2 refresh token not workingGoogle OAuth 2 access token not working as expected some hours after authorizingHow to implement auto refresh token in graphql for jwt based authentication?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















It works fine if I manually provide access tokens but those expire in 1 hour.
So, whenever I try to do one of the following :



  • skip giving access token in createTransport function

  • provide expired access token

  • provide a expires value prior to current date

In each of the the above case I get an error 'unauthorized_client' with code: EAUTH, command: AUTH XOAUTH2

Simply, Nodemailer is not generating new access token but throwing errors.

I am providing the following while creating transport: type, user, clientId, clientSecret, refreshToken, accessToken and expires.

I have also tried providing authentication details in message options as given in 5th example here but that also doesn't works.

Please help me get out of this and thanks in advance.










share|improve this question






















  • Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

    – ty2k
    Mar 22 at 16:55

















0















It works fine if I manually provide access tokens but those expire in 1 hour.
So, whenever I try to do one of the following :



  • skip giving access token in createTransport function

  • provide expired access token

  • provide a expires value prior to current date

In each of the the above case I get an error 'unauthorized_client' with code: EAUTH, command: AUTH XOAUTH2

Simply, Nodemailer is not generating new access token but throwing errors.

I am providing the following while creating transport: type, user, clientId, clientSecret, refreshToken, accessToken and expires.

I have also tried providing authentication details in message options as given in 5th example here but that also doesn't works.

Please help me get out of this and thanks in advance.










share|improve this question






















  • Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

    – ty2k
    Mar 22 at 16:55













0












0








0








It works fine if I manually provide access tokens but those expire in 1 hour.
So, whenever I try to do one of the following :



  • skip giving access token in createTransport function

  • provide expired access token

  • provide a expires value prior to current date

In each of the the above case I get an error 'unauthorized_client' with code: EAUTH, command: AUTH XOAUTH2

Simply, Nodemailer is not generating new access token but throwing errors.

I am providing the following while creating transport: type, user, clientId, clientSecret, refreshToken, accessToken and expires.

I have also tried providing authentication details in message options as given in 5th example here but that also doesn't works.

Please help me get out of this and thanks in advance.










share|improve this question














It works fine if I manually provide access tokens but those expire in 1 hour.
So, whenever I try to do one of the following :



  • skip giving access token in createTransport function

  • provide expired access token

  • provide a expires value prior to current date

In each of the the above case I get an error 'unauthorized_client' with code: EAUTH, command: AUTH XOAUTH2

Simply, Nodemailer is not generating new access token but throwing errors.

I am providing the following while creating transport: type, user, clientId, clientSecret, refreshToken, accessToken and expires.

I have also tried providing authentication details in message options as given in 5th example here but that also doesn't works.

Please help me get out of this and thanks in advance.







node.js oauth-2.0 gmail-api google-oauth2 nodemailer






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 16:27









Ranveer SinghRanveer Singh

11




11












  • Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

    – ty2k
    Mar 22 at 16:55

















  • Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

    – ty2k
    Mar 22 at 16:55
















Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

– ty2k
Mar 22 at 16:55





Could you please provide a sample of your code? Google's Using OAuth 2.0 for Web Server Applications documentation is really good and has a link to their Google APIs Node.js Client repo which has some useful code samples. Alternatively, you could look at Let less secure apps access your account which is simpler to implement but doesn't provide the same sort of robust options as OAuth2.

– ty2k
Mar 22 at 16:55












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303946%2fnot-able-to-send-mails-using-nodemailer-and-access-tokens-obtained-from-gmail%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303946%2fnot-able-to-send-mails-using-nodemailer-and-access-tokens-obtained-from-gmail%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript