Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSO integration with login.microsoftonline.com not in login.live.com #357

Closed
ald3rson opened this issue Aug 5, 2022 · 4 comments
Closed

Comments

@ald3rson
Copy link

ald3rson commented Aug 5, 2022

What steps will reproduce the problem?

Hello. Im developing an SSO for school / work email for microsoft. the problem is login.live.com is not redirecting me to login.microsoftonline.com. I did research that live.com is for personal use and work/school is for microsoftonline.com

So what I did is to change the yii2-client/authclient/src/client/Live.php

class Live extends OAuth2
{
public $authUrl = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
public $tokenUrl = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
public $apiBaseUrl = 'https://graph.microsoft.com/v1.0';

public function init()
{
    parent::init();
    if ($this->scope === null) {
        $this->scope = implode(',', [
            'User.Read',
        ]);
    }
}

}

What's expected?

Im expecting to run smoothly,

What do you get instead?

but errors were displayed. Access token is empty.
Screen Shot 2022-08-05 at 10 19 03 AM

This is my redirect URI in azure AD. the question mark '?' sign in the http://localhost/site/auth?authclient=live will not save in Azure AD so I change it to http://localhost/site/auth%3Fauthclient=live

Screen Shot 2022-08-05 at 10 30 26 AM

Additional info

Q A
Yii version 2.0
Yii Auth Client version 2.1
Yii HTTP Client version 1.1
PHP version 7
Operating system Windows Server 2012
@ald3rson
Copy link
Author

ald3rson commented Aug 5, 2022

Sorry, I just add this on the bottom yii2-client/authclient/src/client/Live.php and it works.

public function applyAccessTokenToRequest($request, $accessToken)
{
    $request->addHeaders(['Authorization' => 'Bearer '. $accessToken->getToken()]);
}

@michael-schaefer-eu
Copy link

I thought that Microsoft does not support the Live OAuth2 authentication method anymore?

When I open this link from the Live class, I get this error:

Bildschirmfoto vom 2022-11-29 14-03-30

Or is it only about the App Registration ?

edegaudenzi pushed a commit to edegaudenzi/yii2-authclient that referenced this issue Sep 28, 2023
@edegaudenzi
Copy link

UPDATE: the PR resolving this issue has been closed and not merged by @bizley with the following comment:

Thank you for your contribution but unfortunately we are not adding any more clients. Please release it as a separate package.

Not sure why of this decision and as a result, we are not adding one of the most used external authentication providers, which would also make the plugin "business grade" (hence more popular), being Microsoft365 the reference for the vast majority of Companies around the globe.
Please @bizley give us a little bit more in-deep details if you can, so at least we can close down this issue as 'non-resolved'.

I will not release as a separate package: way too hassle for such a tiny thing, especially if there is already a solution made on purpose to host it.

@readers: if you need this to authenticate your yii2 project against Microsoft365 to follow the normal yii\authclient\OAuth2 mechanism, you can still do that by taking 3 changes from this commit:

  • Updated asset picture with Microsoft365 Logo: src/assets/authchoice.png
  • The extra CSS: src/assets/authchoice.css
  • The main class: src/clients/Microsoft365.php

Live long and prosper \\//_

@bizley
Copy link
Member

bizley commented Oct 6, 2023

I understand the frustration but please try to look at this from the maintainers perspective. This is a design decision made 9 years ago. Since then we don't accept new client implementations what you can verify by looking at the not accepted PRs.

3rd-party-made extensions are more than welcome.

@ald3rson please follow the implementation and instructions provided kindly by @edegaudenzi , thank you.

@bizley bizley closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants