Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,14 @@

try {
const token = await self.oauth.token(request, response)
let expires_in;

Check failure on line 473 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Extra semicolon

Check failure on line 473 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Identifier 'expires_in' is not in camel case
if (token.accessTokenExpiresAt != null) {
const expiresAtMs = new Date(token.accessTokenExpiresAt).getTime()

Check failure on line 475 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Expected indentation of 10 spaces but found 12
if (!Number.isNaN(expiresAtMs)) {

Check failure on line 476 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Expected indentation of 10 spaces but found 12
// RFC 6749 §4.2.2 / §5.1: expires_in is lifetime in seconds from response time

Check failure on line 477 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Expected indentation of 12 spaces but found 16
expires_in = Math.max(0, Math.floor((expiresAtMs - Date.now()) / 1000))

Check failure on line 478 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Identifier 'expires_in' is not in camel case

Check failure on line 478 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Expected indentation of 12 spaces but found 16
}

Check failure on line 479 in lib/oauth.js

View workflow job for this annotation

GitHub Actions / StandardJS lint

Expected indentation of 10 spaces but found 12
}
res
.set({
'Content-Type': 'application/json',
Expand All @@ -480,7 +488,8 @@
.json({
access_token: token.accessToken,
token_type: 'bearer',
expires_in: token.accessTokenExpiresAt,
expires_in: expires_in,
expires_at: token.accessTokenExpiresAt,
refresh_token: token.refreshToken
})
} catch (err) {
Expand Down
Loading