소스 검색

fixed refresh token issue

Former-commit-id: 6b2bc9181cf1be5a4e3bb88a564786d3d3b15c8f
Gildas 6 년 전
부모
커밋
f44c9f8c18
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  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 };
 			}
 		}