[gnome-online-accounts] examples: Print out keys for all the accounts
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] examples: Print out keys for all the accounts
- Date: Fri, 11 Sep 2015 15:07:33 +0000 (UTC)
commit f8d6bce148f7d06f8eadf6a659e57d341e6892bd
Author: Bastien Nocera <hadess hadess net>
Date: Sat Oct 5 00:49:02 2013 +0200
examples: Print out keys for all the accounts
This is useful for debugging applications based on GOA, as well as
debugging backends.
https://bugzilla.gnome.org/show_bug.cgi?id=754840
src/examples/list-accounts.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/examples/list-accounts.c b/src/examples/list-accounts.c
index 1647d5c..777acdf 100644
--- a/src/examples/list-accounts.c
+++ b/src/examples/list-accounts.c
@@ -36,10 +36,29 @@ main (int argc, char **argv)
accounts = goa_client_get_accounts (client);
for (l = accounts; l != NULL; l = l->next) {
+ GoaOAuth2Based *oauth2 = NULL;
+
account = goa_object_get_account (GOA_OBJECT (l->data));
- g_print ("%s at %s\n",
+ g_print ("%s at %s (%s)\n",
goa_account_get_presentation_identity (account),
- goa_account_get_provider_name (account));
+ goa_account_get_provider_name (account),
+ goa_account_get_provider_type (account));
+ oauth2 = goa_object_get_oauth2_based (GOA_OBJECT (l->data));
+ if (oauth2) {
+ gchar *access_token;
+ if (goa_oauth2_based_call_get_access_token_sync (oauth2,
+ &access_token,
+ NULL,
+ NULL,
+ NULL)) {
+ g_print ("\tAccessToken: %s\n", access_token);
+ g_free (access_token);
+ }
+ g_print ("\tClientId: %s\n\tClientSecret: %s\n",
+ goa_oauth2_based_get_client_id (oauth2),
+ goa_oauth2_based_get_client_secret (oauth2));
+ }
+ g_clear_object (&oauth2);
}
g_list_free_full (accounts, (GDestroyNotify) g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]