XeroAPI / xoauth

A CLI tool for obtaining JWTs from OpenId Connect providers
MIT License
49 stars 16 forks source link

Refresh Token Confusion #19

Open silenuz opened 3 years ago

silenuz commented 3 years ago

When I run a forced refresh things don't seem to work as expected.

So I connect to an app it goes as expected, the grant completes fine. When I run xoauth token client I see something like this:

`{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4 REDACTED",

"id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4R REDACTED",

"refresh_token": "6937da68856f6ec7a9df734066c87ac85a29d34859be7 REDACTED",

"token_type": "Bearer",

"expires_in": 1800,

"expires_at": 1608247020 }`

So far so good. However if I run xoauth client token --refresh It again looks good:

`{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4 REDACTED",

"id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4R REDACTED",

"refresh_token": "85d37f3e9d0765d4e58d0853bc1f30b67a09c3021db77f3c57a REDACTED,

"token_type": "Bearer",

"expires_in": 1800,

"expires_at": 1608247306 ` It still looks good however the next time I call xoauth token client I get this:

`{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4R REDACTED",

"id_token": "",

"refresh_token": "85d37f3e9d0765d4e58d0853bc1f30b67a09c3021db77f3c57a REDACTED",

"token_type": "",

"expires_in": 0,

"expires_at": 1608247306 `

Note that suddenly the token says it is expired, id token and token type are now blank. So I'm wondering what is the proper way to use the cli client to refresh a token?

Also on Linux at least the output from xoauth list is piped to stderr instead of stdout.

iamjoya commented 3 years ago

Encountered the same issue as well when calling xoauth token client it returns these "id_token": "",, "token_type": "", "expires_in": 0,".