Solved. Just added in the authorize function the offline access parameter:
webAuth.authorize({
connection: 'google-oauth2',
connection_scope: 'https://www.googleapis.com/auth/youtube.readonly,https://www.googleapis.com/auth/yt-analytics.readonly',
scope: 'openid profile',
accessType: 'offline',
approvalPrompt: 'force'
})