private async void Logout() { await _oidcIdentityService.Logout(_credentials?.IdentityToken); _credentials = null; OnPropertyChanged(nameof(TokenExpirationText)); OnPropertyChanged(nameof(AccessTokenText)); OnPropertyChanged(nameof(IdTokenText)); OnPropertyChanged(nameof(IsLoggedIn)); OnPropertyChanged(nameof(IsNotLoggedIn)); }
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)); }