summaryrefslogtreecommitdiff
path: root/alpine/imap.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-01-15 12:42:06 -0700
committerEduardo Chappa <chappa@washington.edu>2020-01-15 12:42:06 -0700
commit9822842646bc2b940d4b98a260ee4e3ac26fce57 (patch)
tree9d468eb7a6d6b3a41c6c8cd7d542009cb498bc5b /alpine/imap.c
parent36fcd566e99d76543c28ce985fc71e8a7cfb6c83 (diff)
downloadalpine-9822842646bc2b940d4b98a260ee4e3ac26fce57.tar.xz
* Add configuration screen for XOAUTH, so users can configure their own
client-id and client-secret information.
Diffstat (limited to 'alpine/imap.c')
-rw-r--r--alpine/imap.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index 49a1a6bd..fe38c06f 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -131,6 +131,68 @@ int init_wincred_funcs(void);
static char *details_cert, *details_host, *details_reason;
+extern XOAUTH2_INFO_S xoauth_default[];
+
+/*
+ * This is the private information of the client, which is passed to
+ * c-client for processing. Every c-client application must have its
+ * own.
+ */
+OAUTH2_S alpine_oauth2_list[] =
+{
+ {GMAIL_NAME,
+ {"imap.gmail.com", "smtp.gmail.com", NULL, NULL},
+ {{"client_id", NULL},
+ {"client_secret", NULL},
+ {"code", NULL},
+ {"refresh_token", NULL},
+ {"scope", "https://mail.google.com/"},
+ {"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"},
+ {"grant_type", "authorization_code"},
+ {"grant_type", "refresh_token"},
+ {"response_type", "code"},
+ {"state", NULL},
+ {"prompt", NULL}
+ },
+ {{"GET", "https://accounts.google.com/o/oauth2/auth",
+ {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_End, OA2_End, OA2_End}},
+ {"POST", "https://accounts.google.com/o/oauth2/token",
+ {OA2_Id, OA2_Secret, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Code, OA2_End, OA2_End}},
+ {"POST", "https://accounts.google.com/o/oauth2/token",
+ {OA2_Id, OA2_Secret, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End}}
+ },
+ NULL, 0
+ },
+#if 0
+ {"Outlook",
+ {"outlook.office365.com", "smtp.gmail.com", NULL, NULL},
+// {{"client_id", "2d681b88-9675-4ff0-b033-4de97dcb7a04"},
+// {"client_secret", "FHLY770;@%fmrzxbnEKG44!"},
+ {{"client_id", NULL},
+ {"client_secret", NULL},
+ {"code", NULL},
+ {"refresh_token", NULL},
+ {"scope", "openid offline_access profile https://outlook.office.com/mail.readwrite https://outlook.office.com/mail.readwrite.shared https://outlook.office.com/mail.send https://outlook.office.com/mail.send.shared https://outlook.office.com/calendars.readwrite https://outlook.office.com/calendars.readwrite.shared https://outlook.office.com/contacts.readwrite https://outlook.office.com/contacts.readwrite.shared https://outlook.office.com/tasks.readwrite https://outlook.office.com/tasks.readwrite.shared https://outlook.office.com/mailboxsettings.readwrite https://outlook.office.com/people.read https://outlook.office.com/user.readbasic.all"},
+ {"redirect_uri", "https://login.microsoftonline.com/common/oauth2/nativeclient"},
+ {"grant_type", "authorization_code"},
+ {"grant_type", "refresh_token"},
+ {"response_type", "code"},
+ {"state", NULL},
+ {"prompt", "login"}
+ },
+ {{"GET", "https://login.microsoftonline.com/common/oauth2/authorize",
+ {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_State, OA2_Prompt, OA2_End}},
+ {"POST", "https://login.microsoftonline.com/common/oauth2/token",
+ {OA2_Id, OA2_Secret, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Code, OA2_Scope, OA2_End}},
+ {"POST", "https://login.microsoftonline.com/common/oauth2/token",
+ {OA2_Id, OA2_Secret, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End}}
+ },
+ NULL, 0
+ },
+#endif
+ { NULL, NULL, NULL, NULL, NULL, 0},
+};
+
typedef struct auth_code_s {
char *code;
int answer;