7
7
*
8
8
* https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps
9
9
*
10
- * redirect_uri=https://{DOMAIN}/?LoginO365
11
- * redirect_uri=https://{DOMAIN}/LoginO365
10
+ * https://learn.microsoft.com/en-us/entra/identity-platform/reply-url#query-parameter-support-in-redirect-uris
11
+ * Azure: redirect_uri=https://{DOMAIN}/?LoginO365
12
+ * Personal: redirect_uri=https://{DOMAIN}/LoginO365
12
13
*/
13
14
14
15
use RainLoop \Model \MainAccount ;
@@ -18,8 +19,8 @@ class LoginO365Plugin extends \RainLoop\Plugins\AbstractPlugin
18
19
{
19
20
const
20
21
NAME = 'Office365/Outlook OAuth2 ' ,
21
- VERSION = '0.2 ' ,
22
- RELEASE = '2024-08-13 ' ,
22
+ VERSION = '0.3 ' ,
23
+ RELEASE = '2024-09-29 ' ,
23
24
REQUIRED = '2.36.1 ' ,
24
25
CATEGORY = 'Login ' ,
25
26
DESCRIPTION = 'Office365/Outlook IMAP, Sieve & SMTP login using RFC 7628 OAuth2 ' ;
@@ -47,6 +48,7 @@ public function Init() : void
47
48
48
49
public function httpPaths (array &$ aPaths ) : void
49
50
{
51
+ // Personal accounts workaround
50
52
if (!empty ($ _SERVER ['PATH_INFO ' ]) && \str_ends_with ($ _SERVER ['PATH_INFO ' ], 'LoginO365 ' )) {
51
53
$ aPaths = ['LoginO365 ' ];
52
54
}
@@ -113,7 +115,7 @@ public function ServiceLoginO365() : string
113
115
$ iExpires += $ aResponse ['expires_in ' ];
114
116
115
117
$ oO365 ->setAccessToken ($ sAccessToken );
116
- $ aUserInfo = $ oO365 ->fetch ('https://graph.microsoft.com/oidc/userinfo" ' );
118
+ $ aUserInfo = $ oO365 ->fetch ('https://graph.microsoft.com/oidc/userinfo ' );
117
119
if (200 != $ aUserInfo ['code ' ]) {
118
120
throw new \RuntimeException ("HTTP: {$ aResponse ['code ' ]}" );
119
121
}
@@ -154,6 +156,12 @@ public function ServiceLoginO365() : string
154
156
public function configMapping () : array
155
157
{
156
158
return [
159
+ \RainLoop \Plugins \Property::NewInstance ('personal ' )
160
+ ->SetLabel ('Use with personal accounts ' )
161
+ ->SetType (\RainLoop \Enumerations \PluginPropertyType::BOOL )
162
+ ->SetDefaultValue (true )
163
+ ->SetAllowedInJs ()
164
+ ->SetDescription ('Sign in users with personal Microsoft accounts such as Outlook.com (Hotmail) ' ),
157
165
\RainLoop \Plugins \Property::NewInstance ('client_id ' )
158
166
->SetLabel ('Client ID ' )
159
167
->SetType (\RainLoop \Enumerations \PluginPropertyType::STRING )
0 commit comments