@@ -37,6 +37,8 @@ export const ERRORS = {
37
37
TIMEOUT : 'TIMEOUT' ,
38
38
} ;
39
39
40
+ const ONE_MINUTE = 60 * 1000 ;
41
+
40
42
export function persistentAuthStrategy ( ) {
41
43
function createCachedToken ( ) {
42
44
/**
@@ -53,8 +55,8 @@ export function persistentAuthStrategy() {
53
55
const now = Date . now ( ) ;
54
56
timeSinceAccess += now - lastAccess ;
55
57
lastAccess = now ;
56
- // Reset token if it has been more than 5 minutes since last access
57
- if ( timeSinceAccess > 1 * 60 * 1000 ) {
58
+ // Reset token if it has been more than a minute since last access
59
+ if ( timeSinceAccess > ONE_MINUTE ) {
58
60
timeSinceAccess = 0 ;
59
61
token = '' ;
60
62
}
@@ -104,11 +106,11 @@ export function persistentAuthStrategy() {
104
106
* @param {string } data.code
105
107
* @param {Object } options
106
108
* @param {boolean } [options.openInBrowser=true] - Whether to open the URL in the default browser
107
- * @param {boolean } [options.copyToCliboard =true] - Whether to copy the code to clipboard
109
+ * @param {boolean } [options.copyToClipboard =true] - Whether to copy the code to clipboard
108
110
* @returns {Promise<void> }
109
111
*/
110
- async function logAuthInformation ( data , { openInBrowser = true , copyToCliboard = true } = { } ) {
111
- if ( copyToCliboard ) {
112
+ async function logAuthInformation ( data , { openInBrowser = true , copyToClipboard = true } = { } ) {
113
+ if ( copyToClipboard ) {
112
114
await clipboardy . write ( data . code ) ;
113
115
console . warn ( `Pasted authentication code ${ data . code } to system clipboard...` ) ;
114
116
} else {
0 commit comments