Explorar o código

fixed refresh token issue

Former-commit-id: 6b2bc9181cf1be5a4e3bb88a564786d3d3b15c8f
Gildas %!s(int64=6) %!d(string=hai) anos
pai
achega
f44c9f8c18
Modificáronse 1 ficheiros con 6 adicións e 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 };
 			}
 		}