Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Laracast13's avatar

Laravel Socialite

Hi, Using Laravel Socialite for Microsoft Make installation using this steps https://socialiteproviders.com/Microsoft/

Controller

    public function authMicrosoft()
    {    
        return Socialite::driver('microsoft')->redirect();
    }
    public function callBackMicrosoft()
    {    
        $microsoftUser = Socialite::driver('microsoft')->stateless()->user();
       dd($microsoftUser);
    }

But after call back getting this error:

Client error: `POST https://login.microsoftonline.com/common/oauth2/v2.0/token` resulted in a `400 Bad Request` response: {"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'co (truncated...)
0 likes
2 replies
Braunson's avatar

Look at the full error being returned and see what parameter is missing.

johannesobier's avatar

Had the same problem. After a long search and try-and-error session I found out, that I had to include the tenant_id in the config array in config/services.php. And in opposite to the #+!% documentation of MS from which I had the impression it should be 'tenant_id' => 'common', it was the real tenant_id. The same I used before withe the Socialite plugin socialiteproviders/microsoft-azure.

Hope, that may help

Please or to participate in this conversation.