Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

[Asp.net core 2 preview 2 ] macOs HttpContext.SignInAsync build error #1281

Closed
AlexTeixeira opened this issue Jun 29, 2017 · 2 comments
Closed

Comments

@AlexTeixeira
Copy link

Hello guys,

I look a this issue #1219 to implement my a basic cookie authentication without Identity.

Core version : 2.0.0-preview2-006497
macOs Sierra version : 10.12.5
VS Code : 1.13.1 (1.13.1)
** Omnisharp** : 1.11.0

So basicaly I have the same configuration in startup that show on previous issue

app.UseAuthentication();

 services.AddCookieAuthentication(o =>
            {
                o.CookieName = CLIENT_COOKIE;
                o.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Public/Home");
                //o.LogoutPath = "/api/logout";
                o.ExpireTimeSpan = TimeSpan.FromDays(1);

            });

If I use the new code in my method

await HttpContext.SignInAsync(Startup.CLIENT_COOKIE, new ClaimsPrincipal(identity), props);
I have a build error

error CS1061: 'HttpContext' does not contain a definition for 'SignInAsync' and no extensi
on method 'SignInAsync' accepting a first argument of type 'HttpContext' could be found (are you missing a using directive or an assembly reference?)

If I keep the old method, when I try to sign I go this runtime exception

InvalidOperationException: No authentication handler is configured to handle the scheme: ClientCookie

I'm missing something ?

@AlexTeixeira
Copy link
Author

... You change the namespace too.

I did not think to check the namespace and the intellisense do not propose it.

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants