Is it possible to read a users group membership in Microsoft Graph API? -


i using microsoft graph api log users webapp using domain email.

i able read users basic profile using

$token = $_session['access_token']; $graph = new graph(); $graph->setaccesstoken($token); $response = $graph->createrequest("get", "/me")->setreturntype(model\user::class)->execute(); var_dump($response); 

is there way can read groups? or way can instruct domain admin pass information app?

you can using memberof method: https://graph.microsoft.com/v1.0/me/memberof.

note you'll need 1 of following permission scopes added initial token request.

  • directory.read.all
  • directory.readwrite.all
  • directory.accessasuser.all

regardless of of these scopes choose, require administrative consent before regular user can authorize them. this, you'll first need have them go through “admin consent” workflow. workflow requires administrator once complete users of application have “admin consent” restricted scope.

for example, authenticate users redirecting them

https://login.microsoftonline.com/common/oauth2/authorize?<your params>.

since scope requires admin however, fist need obtain consent first having admin authenticate redirecting them to

https://login.microsoftonline.com/common/adminconsent?<yours params>.

once admin grants consent, normal users able use oauth authenticate.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -