Fix logging output when authentication authorisation fails (#1156)

* If OneDrive generates an auth error, dont log that the auth was sucessful
This commit is contained in:
abraunegg 2020-11-21 06:46:05 +11:00 committed by GitHub
parent ac4da2e2ba
commit a4a5a5f267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -600,10 +600,17 @@ int main(string[] args)
// was the application just authorised?
if (cfg.applicationAuthorizeResponseUri) {
// Application was just authorised
log.log("\nApplication has been successfully authorised, however no additional command switches were provided.\n");
log.log("Please use --help for further assistance in regards to running this application.\n");
// Use exit scopes to shutdown API
return EXIT_SUCCESS;
if (exists(cfg.refreshTokenFilePath)) {
// OneDrive refresh token exists
log.log("\nApplication has been successfully authorised, however no additional command switches were provided.\n");
log.log("Please use --help for further assistance in regards to running this application.\n");
// Use exit scopes to shutdown API
return EXIT_SUCCESS;
} else {
// we just authorised, but refresh_token does not exist .. probably an auth error
log.log("\nApplication has not been successfully authorised. Please check your URI response entry and try again.\n");
return EXIT_FAILURE;
}
} else {
// Application was not just authorised
log.log("\n--synchronize or --monitor switches missing from your command line input. Please add one (not both) of these switches to your command line or use --help for further assistance.\n");