fix onedrive auth process
This commit is contained in:
parent
d53569fe71
commit
02e5f9b5a0
17
src/main.ts
17
src/main.ts
@ -105,6 +105,16 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
"remotely-save-cb-onedrive",
|
"remotely-save-cb-onedrive",
|
||||||
async (inputParams) => {
|
async (inputParams) => {
|
||||||
if (inputParams.code !== undefined) {
|
if (inputParams.code !== undefined) {
|
||||||
|
if (this.oauth2Info.helperModal !== undefined) {
|
||||||
|
this.oauth2Info.helperModal.contentEl.empty();
|
||||||
|
this.oauth2Info.helperModal.contentEl.createEl("p", {
|
||||||
|
text: "Connecting to Onedrive...",
|
||||||
|
});
|
||||||
|
this.oauth2Info.helperModal.contentEl.createEl("p", {
|
||||||
|
text: "Please DO NOT close this modal.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let rsp = await sendAuthReqOnedrive(
|
let rsp = await sendAuthReqOnedrive(
|
||||||
this.settings.onedrive.clientID,
|
this.settings.onedrive.clientID,
|
||||||
this.settings.onedrive.authority,
|
this.settings.onedrive.authority,
|
||||||
@ -116,13 +126,6 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
throw Error(`${JSON.stringify(rsp)}`);
|
throw Error(`${JSON.stringify(rsp)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.oauth2Info.helperModal !== undefined) {
|
|
||||||
this.oauth2Info.helperModal.contentEl.empty();
|
|
||||||
this.oauth2Info.helperModal.contentEl.createEl("p", {
|
|
||||||
text: "Please wait, the plugin is trying to connect to Onedrive...",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
rsp = rsp as AccessCodeResponseSuccessfulType;
|
rsp = rsp as AccessCodeResponseSuccessfulType;
|
||||||
this.settings.onedrive.accessToken = rsp.access_token;
|
this.settings.onedrive.accessToken = rsp.access_token;
|
||||||
this.settings.onedrive.accessTokenExpiresAtTime =
|
this.settings.onedrive.accessTokenExpiresAtTime =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user