コード例 #1
0
        private IList <KeyValuePair <string, string> > MakeRequestBody(MicrosoftGraphAuthSettings _authSettings, string accessToken, TypeTokenRequest type)
        {
            var list = new List <KeyValuePair <string, string> >();

            switch (type)
            {
            case TypeTokenRequest.AccessToken:
                list.Add(new KeyValuePair <string, string>("code", accessToken));
                list.Add(new KeyValuePair <string, string>("grant_type", "authorization_code"));
                break;

            case TypeTokenRequest.RefreshToken:
                list.Add(new KeyValuePair <string, string>("refresh_token", accessToken));
                list.Add(new KeyValuePair <string, string>("grant_type", "refresh_token"));
                break;
            }
            list.Add(new KeyValuePair <string, string>("client_id", _authSettings.AppId));
            list.Add(new KeyValuePair <string, string>("client_secret", _authSettings.AppSecret));
            list.Add(new KeyValuePair <string, string>("redirect_uri", _authSettings.RedirectUri));

            return(list);
        }
コード例 #2
0
 public UserService(IOptions <MicrosoftGraphApiSettings> microsoftGraphApiSettingsOptions, IOptions <MicrosoftGraphAuthSettings> msftAuthSettings) : base(microsoftGraphApiSettingsOptions)
 {
     _msftAuthSettings = msftAuthSettings.Value;
 }