File tree Expand file tree Collapse file tree 3 files changed +294
-12
lines changed Expand file tree Collapse file tree 3 files changed +294
-12
lines changed Original file line number Diff line number Diff line change @@ -23,32 +23,28 @@ public class MSGraphService : IMSGraphService
23
23
/// </returns>
24
24
public async Task < IEnumerable < User > > GetUsersAsync ( string accessToken )
25
25
{
26
- var usersDropDown = new List < SelectListItem > ( ) ;
27
-
26
+ IGraphServiceUsersCollectionPage users = null ;
27
+
28
28
try
29
29
{
30
30
PrepareAuthenticatedClient ( accessToken ) ;
31
- IGraphServiceUsersCollectionPage users = await graphServiceClient . Users . Request ( )
31
+ users = await graphServiceClient . Users . Request ( )
32
32
. Filter ( $ "accountEnabled eq true")
33
33
. Select ( "id, userPrincipalName" )
34
34
. GetAsync ( ) ;
35
35
36
36
if ( users ? . CurrentPage . Count > 0 )
37
37
{
38
- usersDropDown = users . Select ( u => new SelectListItem
39
- {
40
- Text = u . UserPrincipalName ,
41
- Value = u . Id
42
- } ) . ToList ( ) ;
38
+ return users ;
43
39
}
44
40
}
45
41
catch ( ServiceException e )
46
42
{
47
43
Debug . WriteLine ( "We could not retrieve the user's list: " + $ "{ e } ") ;
48
44
return null ;
49
45
}
50
-
51
- return usersDropDown ;
46
+
47
+ return users ;
52
48
}
53
49
54
50
/// <summary>
Original file line number Diff line number Diff line change @@ -53,11 +53,12 @@ public IActionResult Onboard()
53
53
54
54
// Create an OAuth2 request, using the web app as the client.This will trigger a consent flow that will provision the app in the target tenant.
55
55
string authorizationRequest = string . Format (
56
- "{0}common/adminconsent?client_id={1}&redirect_uri={2}&state={3}" ,
56
+ "{0}common/v2.0/ adminconsent?client_id={1}&redirect_uri={2}&state={3}&scope={4 }" ,
57
57
azureADOptions . Instance ,
58
58
Uri . EscapeDataString ( azureADOptions . ClientId ) ,
59
59
Uri . EscapeDataString ( currentUri + "Onboarding/ProcessCode" ) ,
60
- Uri . EscapeDataString ( stateMarker ) ) ;
60
+ Uri . EscapeDataString ( stateMarker ) ,
61
+ Uri . EscapeDataString ( "https://graph.microsoft.com/.default" ) ) ;
61
62
62
63
63
64
return Redirect ( authorizationRequest ) ;
You can’t perform that action at this time.
0 commit comments