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:35:58 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:35:58 +0200
commitd443a3c2509889533ca812c163056bace396b586 (patch)
treee94ffc0d9c054ca4efb8fb327e18dfac88e15dc7 /plugins/authenticator/shotwell/TumblrAuthenticator.vala
parentbb9797c14470641b082ebf635e2ae3cfd5f27a3b (diff)
New upstream version 0.32.1upstream/0.32.1
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");
}
}
}