summaryrefslogtreecommitdiff
path: root/plugins/authenticator/shotwell/TumblrAuthenticator.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
commit31804433d72460cbe0a39f9f8ea5e76058d84cda (patch)
tree2084a84c39f159c6aea254775dc0880d52579d45 /plugins/authenticator/shotwell/TumblrAuthenticator.vala
parenta9898fb3f39c44a85876930ef6b2558052569ae6 (diff)
parentd443a3c2509889533ca812c163056bace396b586 (diff)
Update upstream source from tag 'upstream/0.32.1'
Update to upstream version '0.32.1' with Debian dir c460ad6e13d3c39eaa2d5399059385e64e6fba4c
Diffstat (limited to 'plugins/authenticator/shotwell/TumblrAuthenticator.vala')
-rw-r--r--plugins/authenticator/shotwell/TumblrAuthenticator.vala41
1 files changed, 12 insertions, 29 deletions
diff --git a/plugins/authenticator/shotwell/TumblrAuthenticator.vala b/plugins/authenticator/shotwell/TumblrAuthenticator.vala
index 8907a80..e77814b 100644
--- a/plugins/authenticator/shotwell/TumblrAuthenticator.vala
+++ b/plugins/authenticator/shotwell/TumblrAuthenticator.vala
@@ -119,7 +119,7 @@ namespace Publishing.Authenticator.Shotwell.Tumblr {
public AccessTokenFetchTransaction(Publishing.RESTSupport.OAuth1.Session session, string username, string password) {
base.with_uri(session, "https://www.tumblr.com/oauth/access_token",
Publishing.RESTSupport.HttpMethod.POST);
- add_argument("x_auth_username", Soup.URI.encode(username, ENCODE_RFC_3986_EXTRA));
+ add_argument("x_auth_username", username);
add_argument("x_auth_password", password);
add_argument("x_auth_mode", "client_auth");
}
@@ -127,7 +127,7 @@ namespace Publishing.Authenticator.Shotwell.Tumblr {
internal class Tumblr : Publishing.Authenticator.Shotwell.OAuth1.Authenticator {
public Tumblr(Spit.Publishing.PluginHost host) {
- base(API_KEY, API_SECRET, host);
+ base("Tumblr", API_KEY, API_SECRET, host);
}
public override void authenticate() {
@@ -190,7 +190,7 @@ namespace Publishing.Authenticator.Shotwell.Tumblr {
private void on_authentication_pane_login_clicked( string username, string password ) {
debug("EVENT: on_authentication_pane_login_clicked");
- do_network_login(username, password);
+ do_network_login.begin(username, password);
}
/**
@@ -201,41 +201,24 @@ namespace Publishing.Authenticator.Shotwell.Tumblr {
* @param username the name of the Tumblr user used to login
* @param password the password of the Tumblr user used to login
*/
- private void do_network_login(string username, string password) {
+ private async void do_network_login(string username, string password) {
debug("ACTION: logging in");
host.set_service_locked(true);
host.install_login_wait_pane();
AccessTokenFetchTransaction txn = new AccessTokenFetchTransaction(session,username,password);
- txn.completed.connect(on_auth_request_txn_completed);
- txn.network_error.connect(on_auth_request_txn_error);
-
try {
- txn.execute();
- } catch (Spit.Publishing.PublishingError err) {
+ yield txn.execute_async();
+ debug("EVENT: OAuth authentication request transaction completed; response = '%s'",
+ txn.get_response());
+
+ do_parse_token_info_from_auth_request(txn.get_response());
+ } catch (Error err) {
+ debug("EVENT: OAuth authentication request transaction caused a network error");
host.post_error(err);
}
}
- private void on_auth_request_txn_completed(Publishing.RESTSupport.Transaction txn) {
- txn.completed.disconnect(on_auth_request_txn_completed);
- txn.network_error.disconnect(on_auth_request_txn_error);
-
- debug("EVENT: OAuth authentication request transaction completed; response = '%s'",
- txn.get_response());
-
- do_parse_token_info_from_auth_request(txn.get_response());
- }
-
- private void on_auth_request_txn_error(Publishing.RESTSupport.Transaction txn,
- Spit.Publishing.PublishingError err) {
- txn.completed.disconnect(on_auth_request_txn_completed);
- txn.network_error.disconnect(on_auth_request_txn_error);
-
- debug("EVENT: OAuth authentication request transaction caused a network error");
- host.post_error(err);
- }
-
private void do_parse_token_info_from_auth_request(string response) {
debug("ACTION: extracting access phase credentials from '%s'", response);
@@ -255,7 +238,7 @@ namespace Publishing.Authenticator.Shotwell.Tumblr {
"least one of these is absent"));
this.authentication_failed();
} else {
- session.set_access_phase_credentials(token, token_secret, "");
+ session.set_access_phase_credentials(token, token_secret, "unused");
}
}
}