oauth2-microsoft icon indicating copy to clipboard operation
oauth2-microsoft copied to clipboard

Does not work with professional (office 365) accounts

Open vicenteribes opened this issue 5 years ago • 3 comments

I have used this plugin in a project, and worked perfect with personal microsoft accounts (free outlook.com accounts) but couldn't work with professional (office 365 accounts)

I have edited /src/Provider/Microsoft.php changing the following lines:

protected $urlAuthorize = 'https://login.microsoftonline.com/common/oauth2/authorize'; protected $urlAccessToken = 'https://login.microsoftonline.com/common/oauth2/token';

and now works with both personal and professional accounts.

Just to inform any other guy with the same issue.

vicenteribes avatar Nov 25 '19 18:11 vicenteribes

@vicenteribes thanks for this. If this is a verifiable change (and maintains support for non-O365 microsoft accounts like hotmail/live accounts assuming they are still supported), I am happy to accept a PR with this permanent change, along with updated passing tests.

stevenmaguire avatar Nov 25 '19 20:11 stevenmaguire

Gostaria de contribuir,

Caso não tenha conta corporativa da Microsoft, essa rotina funciona com contas de e-mails comuns usando o login live.com:

$ provider = novo Stevenmaguire \ OAuth2 \ Client \ Provider \ Microsoft ([ // Necessário 'clientId' => '{seu cliente-id na conta do Azure.', 'clientSecret' => 'seu cliente-secreto usando o Azure' , 'redirectUri' => 'seu link de retorno, deve estar idêntico à conta do Azure', 'urlAuthorize' => 'https://login.live.com/oauth20_authorize.srf', 'urlAccessToken' => 'https://login.live.com/oauth20_token.srf', //'urlResourceOwnerDetails' => 'https://login.live.com/' //Deprecated ]); É necessário criar como configurações de aplicativo no Azure: https://portal.azure.com/#home Localize -> Serviços de aplicativos -> Gerenciar o Diretório Ativo do Azure Localize -> Registros de aplicativos na barra lateral. Crie seu novo registro de aplicativo, ID do cliente, segredo do cliente, tokens de acesso de permissão, etc.

ander1980 avatar Jan 19 '20 01:01 ander1980

@stevenmaguire The solution suggested by @vicenteribes should be correct, as officially published by Microsoft itself: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

More than that, I just verified the connection with a personal account and with a change on the scope separator this library works.

Dasc3er avatar Oct 08 '20 15:10 Dasc3er