New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to dotnetcore 2 #2

Merged
merged 3 commits into from Sep 3, 2017

Conversation

Projects
None yet
3 participants
@nicojs

nicojs commented Aug 16, 2017

@williamhallatt thank you for this awesome example!

I was trying to upgrade it to dotnetcore 2.0. However i don't seem to get it working. I can still request a token, but if i then use that token in an Authorization: Bearer header i just get a 401 unauthorized.

As you can see, the AutomaticAuthenticate and AutomaticChallenge properties don't exist anymore so i removed those. Maybe it has to do with that?

There were some breaking changes in the Authorization/identity space as documented here: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/identity-2x

@williamhallatt

This comment has been minimized.

Owner

williamhallatt commented Aug 17, 2017

Hi Nico, thank you for this!

I have not yet had a look at what is in Core 2.0, so I'm sure your work will be a useful entry point for me.
I'm a bit swamped at the moment, so it might take a while for me to play with this, but I promise you I'll get back to this PR as soon as possible.

Cheers,
William.

@nicojs

This comment has been minimized.

nicojs commented Aug 17, 2017

Good news! Got it working! Apparently i forgot to add app.UseAuthentication. It is important that it comes first, BEFORE app.UseMvc();. Took me about 4 hours to figure that one out 👍

@williamhallatt williamhallatt changed the base branch from master to dotnecore2.0 Sep 3, 2017

@williamhallatt williamhallatt merged commit 5840847 into williamhallatt:dotnecore2.0 Sep 3, 2017

@Harkole

This comment has been minimized.

Harkole commented Sep 7, 2017

Massive thank you guys, I spent hours looking at the migration documentation and struggling with the last few steps but thanks to @nicojs and the blog post I've got there in the end.

Only thing you may want to add (as an extra nice thing) is the Json Formatting of the response to be human readable as that for me would make this a complete package and easy to follow tutorial in WebToken authentication!

services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented; })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment