question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use refresh_token along with access_token when xoauth2 authentication

See original GitHub issue

It seems when I use my access_token its working properly but how I can use my already saved in DB refresh_token?

req.gmail_client = new ImapClient("imap.gmail.com", 993, {
                useSecureTransport: true,
                auth:{
                    user: loggedInUser.gmail_address,
                    xoauth2:loggedInUser.access_token
                },
                enableCompression: true
            });

I need it because when I use newly created access_token it seems working fine but later when I try again its showing me console error like:

[DEBUG][2016-05-03T03:51:53.292Z][undefined] S: W2 OK Success d64mb243647028itb
[DEBUG][2016-05-03T03:51:53.295Z][undefined] Server id updated! [object Object]
[DEBUG][2016-05-03T03:51:53.301Z][undefined] Logging in...
[DEBUG][2016-05-03T03:51:53.302Z][undefined] C: W3 AUTHENTICATE XOAUTH2 "(* value hidden *)"
[DEBUG][2016-05-03T03:51:54.098Z][undefined] S: W3 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
[ERROR][2016-05-03T03:51:54.104Z][undefined] Could not connect to server Error: Invalid credentials (Failure)
[DEBUG][2016-05-03T03:51:54.110Z][undefined] Entering state: 5
[DEBUG][2016-05-03T03:51:54.111Z][undefined] Closing connection...

Thanks in advance

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
felixhammerlcommented, May 3, 2016

gmail app-specific password works nicely.

0reactions
felixhammerlcommented, Jun 29, 2016

is this still current? if so, please re-open

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Are Refresh Tokens and How to Use Them Securely
Refresh token rotation is a technique for getting new access tokens using refresh tokens that goes beyond silent authentication. Refresh token ...
Read more >
Refresh Tokens - OAuth 2.0 Simplified
The presence of the refresh token means that the access token will expire and you'll be able to get a new one without...
Read more >
Authentication Using JWT and Refresh Token — Part 1.
The idea is to generate two tokens: an access token (valid for 10 minutes) and a refresh token ,with a longer lifetime.
Read more >
Get access and refresh tokens - Microsoft Advertising API
Access token request details; Refresh token request details ... Start-Process "https://login.microsoftonline.com/common/oauth2/v2.0/ ...
Read more >
Solved: Difference between Refresh token and Access token
A credential that a client uses to obtain new access tokens without requiring additional user authorization. An instance issues a refresh token ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found