From 9822842646bc2b940d4b98a260ee4e3ac26fce57 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Wed, 15 Jan 2020 12:42:06 -0700 Subject: * Add configuration screen for XOAUTH, so users can configure their own client-id and client-secret information. --- alpine/imap.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'alpine/imap.c') 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; -- cgit v1.2.3-54-g00ecf