Skip to content

Commit 341183a

Browse files
committed
don't attempt to connect to authenticate with google unless system properties are set
1 parent b66fc04 commit 341183a

File tree

1 file changed

+16
-15
lines changed
  • src/main/webapp/scripts/externalTinymcePlugins/googledrive

1 file changed

+16
-15
lines changed

src/main/webapp/scripts/externalTinymcePlugins/googledrive/plugin.min.js

+16-15
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ async function insertFromGoogleDrive() {
1111
if(!gdClientId || !gdScope){
1212
apprise("Missing required system properties for google drive "
1313
+ "integration. Please speak to your rspace administrator");
14-
}
15-
await gapi.load('client:picker');
16-
17-
const client = await google.accounts.oauth2.initTokenClient({
18-
client_id: gdClientId,
19-
scope: gdScope,
20-
callback: onTokenResponse,
21-
error_callback: onTokenResponseError,
22-
});
23-
24-
if(!accessToken){
25-
// show consent screen for user login and authorisation
26-
client.requestAccessToken({prompt: 'consent'});
2714
} else {
28-
// skip consent screen when user has already consented and has a token
29-
client.requestAccessToken({prompt: ''});
15+
await gapi.load('client:picker');
16+
17+
const client = await google.accounts.oauth2.initTokenClient({
18+
client_id: gdClientId,
19+
scope: gdScope,
20+
callback: onTokenResponse,
21+
error_callback: onTokenResponseError,
22+
});
23+
24+
if(!accessToken){
25+
// show consent screen for user login and authorisation
26+
client.requestAccessToken({prompt: 'consent'});
27+
} else {
28+
// skip consent screen when user has already consented and has a token
29+
client.requestAccessToken({prompt: ''});
30+
}
3031
}
3132
}
3233

0 commit comments

Comments
 (0)