コード例 #1
0
        public MainViewModel()
        {
            // const string scope = "openid profile offline_access";
            const string scope = "openid profile";

            _oidcIdentityService     = new OidcIdentityService("gnabbermobileclient", App.CallbackScheme, App.SignoutCallbackScheme, scope, AuthorityUrl);
            ExecuteLogin             = new Command(Login);
            ExecuteRefresh           = new Command(RefreshTokens);
            ExecuteLogout            = new Command(Logout);
            ExecuteGetInfo           = new Command(GetInfo);
            ExecuteCopyAccessToken   = new Command(async() => await Clipboard.SetTextAsync(_credentials?.AccessToken));
            ExecuteCopyIdentityToken = new Command(async() => await Clipboard.SetTextAsync(_credentials?.IdentityToken));
        }
コード例 #2
0
 public MainViewModel()
 {
     _oidcIdentityService = new OidcIdentityService("gnabbermobileclient", App.CallbackScheme, "oidcxamarin101:/signout-callback-oidc", "openid profile offline_access", AuthorityUrl);
     ExecuteLogin         = new Command(Login);
     ExecuteRefresh       = new Command(RefreshTokens);
     ExecuteLogout        = new Command(async() =>
     {
         await _oidcIdentityService.Logout();
         _credentials = null;
         OnPropertyChanged(nameof(TokenExpirationText));
         OnPropertyChanged(nameof(AccessTokenText));
         OnPropertyChanged(nameof(IdTokenText));
         OnPropertyChanged(nameof(IsLoggedIn));
         OnPropertyChanged(nameof(IsNotLoggedIn));
     });
     ExecuteGetInfo           = new Command(GetInfo);
     ExecuteCopyAccessToken   = new Command(async() => await Clipboard.SetTextAsync(_credentials?.AccessToken));
     ExecuteCopyIdentityToken = new Command(async() => await Clipboard.SetTextAsync(_credentials?.IdentityToken));
 }