fix bug 4773, 'remove obsolescent AC_C_CONST'
[claws.git] / src / oauth2.h
blobd4a5d93786cf99c7ec4b53704bb978527db8deb8
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2020-2022 the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifdef HAVE_CONFIG_H
21 #include "claws-features.h"
22 #endif
24 #ifdef USE_OAUTH2
26 #include <glib.h>
28 #include "socket.h"
29 #include "passwordstore.h"
30 #include "smtp.h"
31 #include "prefs_account.h"
33 #define OAUTH2BUFSIZE 8192
35 typedef enum
37 OA2_BASE_URL,
38 OA2_CLIENT_ID,
39 OA2_CLIENT_SECRET,
40 OA2_REDIRECT_URI,
41 OA2_AUTH_RESOURCE,
42 OA2_ACCESS_RESOURCE,
43 OA2_REFRESH_RESOURCE,
44 OA2_RESPONSE_TYPE,
45 OA2_SCOPE_FOR_AUTH,
46 OA2_GRANT_TYPE_ACCESS,
47 OA2_GRANT_TYPE_REFRESH,
48 OA2_TENANT,
49 OA2_STATE,
50 OA2_ACCESS_TYPE,
51 OA2_SCOPE_FOR_ACCESS,
52 OA2_RESPONSE_MODE,
53 OA2_HEADER_AUTH_BASIC
54 } Oauth2Params;
56 typedef enum
58 OAUTH2AUTH_NONE,
59 OAUTH2AUTH_GOOGLE,
60 OAUTH2AUTH_OUTLOOK,
61 OAUTH2AUTH_EXCHANGE,
62 OAUTH2AUTH_MICROSOFT_GCCHIGH,
63 OAUTH2AUTH_YAHOO,
64 OAUTH2AUTH_LAST = OAUTH2AUTH_YAHOO
65 } Oauth2Service;
67 typedef struct _OAUTH2Data OAUTH2Data;
68 struct _OAUTH2Data
70 gchar *refresh_token;
71 gchar *access_token;
72 gint expiry;
73 gchar *expiry_str;
74 gchar *custom_client_id;
75 gchar *custom_client_secret;
78 gint oauth2_init (OAUTH2Data *OAUTH2Data);
79 gint oauth2_check_passwds (PrefsAccount *ac_prefs);
80 gint oauth2_obtain_tokens (Oauth2Service provider, OAUTH2Data *OAUTH2Data, const gchar *authcode);
81 gint oauth2_authorisation_url (Oauth2Service provider, gchar **url, const gchar *custom_client_id);
82 gint oauth2_use_refresh_token (Oauth2Service provider, OAUTH2Data *OAUTH2Data);
83 guchar* oauth2_decode(const gchar *in);
84 void oauth2_encode(const gchar *in);
86 #endif /* USE_GNUTLS */