ADefWebserver / BlazingPizza

A server side Blazor version of the Blazing Pizza project from the Blazor - app building workshop
MIT License
35 stars 13 forks source link

I found that the token which is saved , it remains there after signing out as well. #1

Open iAmBipinPaul opened 5 years ago

iAmBipinPaul commented 5 years ago

I added option to save token from twitter

   twitterOptions.SaveTokens = true;

I Added one class to get the saved token

  public class UserTokenService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        public UserTokenService(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }
        public async Task<string> GetToken()
        {
            var token = await _httpContextAccessor.HttpContext.GetTokenAsync("access_token");
            return token;
        }
    }

After signing out User.Identity.IsAuthenticated is false but token remains there.

I tried this in the cae of aspnet core mvc and it does clear token there.

ADefWebserver commented 5 years ago

They are still working on Authentication/Authorization in Blazor that I think affects the expected behavior related to 'sessions' . See: https://twitter.com/ADefWebserver/status/1122504410557554689

iAmBipinPaul commented 5 years ago

Okay , Thanks !

kyledavi5 commented 5 years ago

So after i log in with twitter the app crashes. Is this probably why?

ADefWebserver commented 5 years ago

In the latest Preview 4, using Visual 2019 preview version, it works on my desktop and laptop...

iAmBipinPaul commented 5 years ago

@kyledavi5 yes , connection to the server breaks, if so try to run this without debugging , it should works.As VS automatically open browser and after login to the twitter , it closes the twitter windows so it stops the Visual studio as well.