Explorar el Código

fixed refresh token issue

Former-commit-id: 6b2bc9181cf1be5a4e3bb88a564786d3d3b15c8f
Gildas hace 6 años
padre
commit
f44c9f8c18
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      lib/gdrive/gdrive.js

+ 6 - 2
lib/gdrive/gdrive.js

@@ -95,8 +95,12 @@ this.GDrive = this.GDrive || (() => {
 				});
 				const response = await getJSON(httpResponse);
 				this.accessToken = response.access_token;
-				this.refreshToken = response.refresh_token;
-				this.expirationDate = Date.now() + (response.expires_in * 1000);
+				if (response.refresh_token) {
+					this.refreshToken = response.refresh_token;
+				}
+				if (response.expires_in) {
+					this.expirationDate = Date.now() + (response.expires_in * 1000);
+				}
 				return { accessToken: this.accessToken, refreshToken: this.refreshToken, expirationDate: this.expirationDate };
 			}
 		}