Closed zerocarbthirty closed 2 years ago
Right, so there are two different versions here:
If you want to obtain information - you should get them from Graph (https://graph.microsoft.com/), however, if you need just the e-mail, you can get them from the token directly - https://github.com/TheNetworg/oauth2-azure#resource-owner
/cc: @zerocarbthirty
Hello and thank you so much for your work on this project.
I was able to get basic authentication and redirect working using the example in the README.
However, I am having trouble understanding the overall usage of the project.
In the example it seems to imply that it is using v2.0 but then later in the code it appears to be using v1.0
$provider->defaultEndPointVersion = TheNetworg\OAuth2\Client\Provider\Azure::ENDPOINT_VERSION_2_0; $baseGraphUri = $provider->getRootMicrosoftGraphUri(null);
then later//$me = $provider->get($provider->getRootMicrosoftGraphUri($token) . '/v1.0/me', $token); //$userEmail = $me['mail'];
Are these two different APIs or is the code that is commented out just outdated/incorrect?Is there a method that can just pull down whatever information is exposed automatically without calling specific URLs?
For instance if the 'scope' is 'openid profile email' is there a method to just retrieve that information while using the already configured endpoint_version specified in the $provider? Basically I just want an object that will give me whatever is exposed to me.
Sorry if my question is confusing, basically I am just trying to verify that:
$me = $provider->get($provider->getRootMicrosoftGraphUri($token) . '/v1.0/me', $token); $userEmail = $me['mail'];
is the "most correct way" of retrieving the email address of a user in the context of the example.
`