* Implement a different way to delete a password from the cache.
[alpine.git] / alpine / xoauth2info.c
blob6ab060d5cb252ed4b5128af990be427fd1e37698
1 /*
2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006-2009 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
14 #include "../alpine/xoauth2.h"
16 XOAUTH2_INFO_S xoauth_default[] = {
17 { GMAIL_NAME, GMAIL_ID, GMAIL_SECRET, GMAIL_TENANT, NULL, AUTHORIZE_FLOW},
18 { OUTLOOK_NAME, OUTLOOK_ID, OUTLOOK_SECRET, OUTLOOK_TENANT, NULL, DEVICE_FLOW},
19 { YAHOO_NAME, YAHOO_ID, YAHOO_SECRET, YAHOO_TENANT, NULL, AUTHORIZE_FLOW},
20 { YANDEX_NAME, YANDEX_ID, YANDEX_SECRET, YANDEX_TENANT, NULL, AUTHORIZE_FLOW},
21 { NULL, NULL, NULL, NULL, NULL, NULL}
25 * This is the private information of the client, which is passed to
26 * c-client for processing. Every c-client application must have its
27 * own.
29 OAUTH2_S alpine_oauth2_list[] = {
30 {GMAIL_NAME,
31 {"imap.gmail.com", "smtp.gmail.com", NULL, NULL},
32 {{"client_id", NULL},
33 {"client_secret", NULL},
34 {"tenant", NULL}, /* not used */
35 {"code", NULL}, /* access code from the authorization process */
36 {"refresh_token", NULL},
37 {"scope", "https://mail.google.com/"},
38 {"redirect_uri", "http://localhost"},
39 {"grant_type", "authorization_code"},
40 {"grant_type", "refresh_token"},
41 {"response_type", "code"},
42 {"state", NULL},
43 {"device_code", NULL}, /* not used */
44 {"code_verifier", NULL}, /* OA2_Extra1: code_verifier, generated by c-client */
45 {"code_challenge", NULL}, /* OA2_Extra2: code_challenge, genrated by c-client */
46 {"code_challenge_method", "S256"}, /* OA2_Extra3: code_challenge_method, given by Alpine */
47 {"login_hint", NULL} /* OA2_Extra4: username, provided by Alpine, filled up by c-client */
49 {{"GET", (unsigned char *) "https://accounts.google.com/o/oauth2/auth", /* authorization address, get access code */
50 {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_Extra2, OA2_Extra3, OA2_Extra4, OA2_End}},
51 {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* Device Info information, not used */
52 {"POST", (unsigned char *) "https://accounts.google.com/o/oauth2/token", /* Address to get refresh token from access code */
53 {OA2_Id, OA2_Secret, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Code, OA2_Extra1, OA2_End, OA2_End}},
54 {"POST", (unsigned char *) "https://accounts.google.com/o/oauth2/token", /* access token from refresh token */
55 {OA2_Id, OA2_Secret, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End, OA2_End}}
57 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */
58 NULL, /* access token */
59 NULL, /* special IMAP ID */
60 0, /* do not hide */
61 0, /* expiration time */
62 0, /* first time indicator */
63 1, /* client secret required */
64 0, /* Cancel refresh token */
65 GMAIL_FLAGS|OA2_OPENSTREAM /* default flags. For Gmail this should be set to OA2_AUTHORIZE */
67 {OUTLOOK_NAME,
68 {"outlook.office365.com", "smtp.office365.com", NULL, NULL},
69 {{"client_id", NULL},
70 {"client_secret", NULL}, /* not used, but needed */
71 {"tenant", NULL}, /* used */
72 {"code", NULL}, /* not used, not needed */
73 {"refresh_token", NULL},
74 {"scope", "offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send"},
75 {"grant_type", "urn:ietf:params:oauth:grant-type:device_code"},
76 {"scope", NULL}, /* not used */
77 {"grant_type", "refresh_token"},
78 {"response_type", "code"}, /* not used */
79 {"state", NULL}, /* not used */
80 {"device_code", NULL}, /* only used for frst time set up */
81 {NULL, NULL}, /* Extra parameter for this server */
82 {NULL, NULL}, /* Extra parameter for this server */
83 {NULL, NULL}, /* Extra parameter for this server */
84 {NULL, NULL} /* Extra parameter for this server */
86 {{NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* Get Access Code, Not used */
87 {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/devicecode", /* first time use and get device code information */
88 {OA2_Id, OA2_Scope, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}},
89 {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */
90 {OA2_Id, OA2_Redirect, OA2_DeviceCode, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}},
91 {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */
92 {OA2_Id, OA2_RefreshToken, OA2_Scope, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End, OA2_End}}
94 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */
95 NULL, /* access token */
96 NULL, /* special IMAP ID */
97 0, /* do not hide */
98 0, /* expiration time */
99 0, /* first time indicator */
100 0, /* client secret required */
101 0, /* Cancel refresh token */
102 OUTLOOK_FLAGS|OA2_OPENSTREAM /* default flags. For OUTLOOK this should be set to OA2_DEVICE */
104 {OUTLOOK_NAME,
105 {"outlook.office365.com", "smtp.office365.com", NULL, NULL},
106 {{"client_id", NULL},
107 {"client_secret", NULL}, /* not used, but needed */
108 {"tenant", NULL}, /* used */
109 {"code", NULL}, /* used during authorization */
110 {"refresh_token", NULL},
111 {"scope", "offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send"},
112 {"redirect_uri", "http://localhost"},
113 {"grant_type", "authorization_code"},
114 {"grant_type", "refresh_token"},
115 {"response_type", "code"},
116 {"state", NULL}, /* not used */
117 {"device_code", NULL}, /* not used */
118 {"code_verifier", NULL}, /* OA2_Extra1: code_verifier, generated by c-client */
119 {"code_challenge", NULL}, /* OA2_Extra2: code_challenge, genrated by c-client */
120 {"code_challenge_method", "S256"}, /* OA2_Extra3: code_challenge_method, given by Alpine */
121 {"login_hint", NULL} /* OA2_Extra4: username, provided by Alpine, filled up by c-client */
123 {{"GET", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/authorize", /* Get Access Code */
124 {OA2_Id, OA2_Scope, OA2_Redirect, OA2_Response, OA2_Extra2, OA2_Extra3, OA2_Extra4, OA2_End}},
125 {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */
126 {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get first Refresh Token and Access token */
127 {OA2_Id, OA2_Redirect, OA2_Scope, OA2_GrantTypeforAccessToken, OA2_Secret, OA2_Code, OA2_Extra1, OA2_End}},
128 {"POST", (unsigned char *) "https://login.microsoftonline.com/\001/oauth2/v2.0/token", /* Get access token from refresh token */
129 {OA2_Id, OA2_RefreshToken, OA2_Scope, OA2_GrantTypefromRefreshToken, OA2_Secret, OA2_End, OA2_End, OA2_End}}
131 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */
132 NULL, /* access token */
133 NULL, /* special IMAP ID */
134 0, /* do not hide */
135 0, /* expiration time */
136 0, /* first time indicator */
137 1, /* client secret required */
138 0, /* Cancel refresh token */
139 OUTLOOK_FLAGS|OA2_OPENSTREAM /* default flags. For OUTLOOK this should be set to OA2_DEVICE */
141 {YAHOO_NAME,
142 {"imap.mail.yahoo.com", "smtp.mail.yahoo.com", NULL, NULL},
143 {{"client_id", NULL},
144 {"client_secret", NULL}, /* used */
145 {"tenant", NULL}, /* not used */
146 {"code", NULL}, /* used during authorization */
147 {"refresh_token", NULL},
148 {"scope", NULL}, /* not used! */
149 {"redirect_uri", "oob"}, /* https://localhost */
150 {"grant_type", "authorization_code"},
151 {"grant_type", "refresh_token"},
152 {"response_type", "code"},
153 {"state", NULL}, /* used */
154 {"device_code", NULL}, /* not used */
155 {NULL, NULL}, /* Extra parameter for this server */
156 {NULL, NULL}, /* Extra parameter for this server */
157 {NULL, NULL}, /* Extra parameter for this server */
158 {NULL, NULL} /* Extra parameter for this server */
160 {{"GET", (unsigned char *) "https://api.login.yahoo.com/oauth2/request_auth", /* Get Access Code */
161 {OA2_Id, OA2_Redirect, OA2_Response, OA2_State, OA2_End, OA2_End, OA2_End, OA2_End}},
162 {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */
163 {"POST", (unsigned char *) "https://api.login.yahoo.com/oauth2/get_token", /* Get first Refresh Token and Access token */
164 {OA2_Id, OA2_Secret, OA2_Redirect, OA2_Code, OA2_GrantTypeforAccessToken, OA2_End, OA2_End, OA2_End}},
165 {"POST", (unsigned char *) "https://api.login.yahoo.com/oauth2/get_token", /* Get access token from refresh token */
166 {OA2_Id, OA2_Secret, OA2_Redirect, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_End, OA2_End, OA2_End}}
168 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */
169 NULL, /* access token */
170 "ALPINE_V1", /* special IMAP ID */
171 1, /* hide */
172 0, /* expiration time */
173 0, /* first time indicator */
174 1, /* client secret required */
175 0, /* Cancel refresh token */
176 YAHOO_FLAGS|OA2_OPENSTREAM /* default flags. For YAHOO this should be set to OA2_AUTHORIZE */
178 {YANDEX_NAME,
179 {"imap.yandex.com", "smtp.yandex.com", NULL, NULL},
180 {{"client_id", NULL},
181 {"client_secret", NULL}, /* not used, but needed */
182 {"tenant", NULL}, /* not used */
183 {"code", NULL}, /* used during authorization */
184 {"refresh_token", NULL},
185 {"scope", NULL}, /* not needed, so not used */
186 {"redirect_uri", "https://oauth.yandex.ru/verification_code"},
187 {"grant_type", "authorization_code"},
188 {"grant_type", "refresh_token"},
189 {"response_type", "code"},
190 {"state", NULL}, /* not used */
191 {"device_code", NULL}, /* not used */
192 {NULL, NULL}, /* Extra parameter for this server */
193 {NULL, NULL}, /* Extra parameter for this server */
194 {NULL, NULL}, /* Extra parameter for this server */
195 {NULL, NULL} /* Extra parameter for this server */
197 {{"GET", (unsigned char *) "https://oauth.yandex.com/authorize", /* Get Access Code */
198 {OA2_Id, OA2_Redirect, OA2_Response, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}},
199 {NULL, NULL, {OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End, OA2_End}}, /* device code, not used */
200 {"POST", (unsigned char *) "https://oauth.yandex.com/token", /* Get first Refresh Token and Access token */
201 {OA2_Id, OA2_Redirect, OA2_GrantTypeforAccessToken, OA2_Secret, OA2_Code, OA2_End, OA2_End, OA2_End}},
202 {"POST", (unsigned char *) "https://oauth.yandex.com/token", /* Get access token from refresh token */
203 {OA2_Id, OA2_RefreshToken, OA2_GrantTypefromRefreshToken, OA2_Secret, OA2_End, OA2_End, OA2_End, OA2_End}}
205 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information, not used */
206 NULL, /* access token */
207 NULL, /* special IMAP ID */
208 0, /* do not hide */
209 0, /* expiration time */
210 0, /* first time indicator */
211 1, /* client secret required */
212 0, /* Cancel refresh token */
213 YANDEX_FLAGS|OA2_OPENSTREAM /* default flags. For YANDEX this should be set to OA2_AUTHORIZE */
215 {NULL, /* Name, unsigned char * */
216 {NULL, NULL, NULL, NULL }, /* host and equivalents */
217 {{NULL, NULL}, /* client-id */
218 {NULL, NULL}, /* client-secret */
219 {NULL, NULL}, /* tenant - outlook */
220 {NULL, NULL}, /* access_code, for authorize method */
221 {NULL, NULL}, /* refresh token */
222 {NULL, NULL}, /* scope */
223 {NULL, NULL}, /* redirect */
224 {NULL, NULL}, /* grant type for access token */
225 {NULL, NULL}, /* grant type from refresh token */
226 {NULL, NULL}, /* response */
227 {NULL, NULL}, /* state */
228 {NULL, NULL}, /* device code */
229 {NULL, NULL}, /* Extra parameter for this server */
230 {NULL, NULL}, /* Extra parameter for this server */
231 {NULL, NULL}, /* Extra parameter for this server */
232 {NULL, NULL} /* Extra parameter for this server */
234 {{NULL, NULL, {0, 0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for authorize */
235 {NULL, NULL, {0, 0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for device login */
236 {NULL, NULL, {0, 0, 0, 0, 0, 0, 0, 0}}, /* method, server, parameters for getting refresh token */
237 {NULL, NULL, {0, 0, 0, 0, 0, 0, 0, 0}} /* method, server, parameters for refreshing access token */
239 {NULL, NULL, NULL, 0, 0, NULL}, /* device_code information */
240 NULL, /* access token */
241 NULL, /* special IMAP ID */
242 0, /* Hide this */
243 0, /* expiration time */
244 0, /* first time */
245 0, /* require secret */
246 0, /* cancel refresh token */
247 0 /* flags */