<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Token_Authentication_Using_ASP.NET_Core</id>
		<title>Token Authentication Using ASP.NET Core - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Token_Authentication_Using_ASP.NET_Core"/>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;action=history"/>
		<updated>2026-06-06T16:35:05Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1129&amp;oldid=prev</id>
		<title>AliIybar at 11:22, 12 April 2017</title>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1129&amp;oldid=prev"/>
				<updated>2017-04-12T11:22:25Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 11:22, 12 April 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l390&quot; &gt;Line 390:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 390:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; http://hostname/controller/route?access_token=MY_TOKEN&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; http://hostname/controller/route?access_token=MY_TOKEN&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The demo code is available on [https://github.com/samueleresca/Blog.TokenAuthGettingStarted Github.]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The demo code is available on [https://github.com/samueleresca/Blog.TokenAuthGettingStarted Github.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Checking user authentication and authorisation ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; bool isAuthorised = false;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; IPrincipal user = HttpContext.User;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; if (user.Identity.IsAuthenticated)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; if (user.IsInRole(&amp;quot;Admin&amp;quot;))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; isAuthorised = true;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; if (!isAuthorised)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160;  return BadRequest(ErrorManager.GetError(103));&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1128&amp;oldid=prev</id>
		<title>AliIybar at 15:43, 11 April 2017</title>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1128&amp;oldid=prev"/>
				<updated>2017-04-11T15:43:42Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:43, 11 April 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l374&quot; &gt;Line 374:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 374:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Authorize controllers ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Authorize controllers ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;All controllers decorated by the attribute '''[Authorize]''' are protected by the JWT authentication.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;All controllers decorated by the attribute '''[Authorize]''' are protected by the JWT authentication.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;You need to pass the token in the HEADER of the request:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Authorization:Bearer &amp;lt;TOKEN&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; client.DefaultRequestHeaders.Add(&amp;quot;Authorization:Bearer&amp;quot;, json.accessToken);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;After you revieced your token, you just have to put into Header:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Key: Authorization&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Value: Bearer YOUR_TOKEN&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;including the whitespace between Baerer and your token!&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In each http call you need to pass the access_token parmeter:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In each http call you need to pass the access_token parmeter:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; http://hostname/controller/route?access_token=MY_TOKEN&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; http://hostname/controller/route?access_token=MY_TOKEN&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The demo code is available on [https://github.com/samueleresca/Blog.TokenAuthGettingStarted Github.]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The demo code is available on [https://github.com/samueleresca/Blog.TokenAuthGettingStarted Github.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1127&amp;oldid=prev</id>
		<title>AliIybar at 10:06, 11 April 2017</title>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1127&amp;oldid=prev"/>
				<updated>2017-04-11T10:06:10Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:06, 11 April 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l81&quot; &gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 81:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Firstly, you need to create a class which implement token options :&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Firstly, you need to create a class which implement token options :&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;using Microsoft.IdentityModel.Tokens;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;public class TokenProviderOptions&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;public class TokenProviderOptions&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; { &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; { &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1126&amp;oldid=prev</id>
		<title>AliIybar at 09:51, 11 April 2017</title>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1126&amp;oldid=prev"/>
				<updated>2017-04-11T09:51:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:51, 11 April 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l113&quot; &gt;Line 113:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 113:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// &amp;lt;/summary&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// &amp;lt;/summary&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; public Func&amp;lt;string, string, Task&amp;lt;ClaimsIdentity&amp;gt;&amp;gt; IdentityResolver { get; set; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; public Func&amp;lt;string, string, Task&amp;lt;ClaimsIdentity&amp;gt;&amp;gt; IdentityResolver { get; set; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// &amp;lt;summary&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// Generates a random value (nonce) for each generated token.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// &amp;lt;/summary&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; /// &amp;lt;remarks&amp;gt;The default nonce is a random GUID.&amp;lt;/remarks&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; public Func&amp;lt;Task&amp;lt;string&amp;gt;&amp;gt; NonceGenerator { get; set; }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; = () =&amp;gt; Task.FromResult(Guid.NewGuid().ToString());&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1125&amp;oldid=prev</id>
		<title>AliIybar: Created page with &quot;Category:Security Category:ASP.NET Category:Core Based on [https://dev.to/samueleresca/developing-token-authentication-using-aspnet-core this document]  == How tok...&quot;</title>
		<link rel="alternate" type="text/html" href="http://logicwiki.co.uk/index.php?title=Token_Authentication_Using_ASP.NET_Core&amp;diff=1125&amp;oldid=prev"/>
				<updated>2017-04-11T09:49:24Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/Category:Security&quot; title=&quot;Category:Security&quot;&gt;Category:Security&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:ASP.NET&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:ASP.NET (page does not exist)&quot;&gt;Category:ASP.NET&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Core&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Core (page does not exist)&quot;&gt;Category:Core&lt;/a&gt; Based on [https://dev.to/samueleresca/developing-token-authentication-using-aspnet-core this document]  == How tok...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Security]]&lt;br /&gt;
[[Category:ASP.NET]]&lt;br /&gt;
[[Category:Core]]&lt;br /&gt;
Based on [https://dev.to/samueleresca/developing-token-authentication-using-aspnet-core this document]&lt;br /&gt;
&lt;br /&gt;
== How token based authentication works ==&lt;br /&gt;
Here's the common steps of the token based authentication:&lt;br /&gt;
&lt;br /&gt;
# user requests access by using username / password;&lt;br /&gt;
# application provides a signed token to the client;&lt;br /&gt;
# client stores that token and sends it along with every request;&lt;br /&gt;
# server verifies token and responds with data;&lt;br /&gt;
&lt;br /&gt;
Every single request will require the token. The token should be sent in the HTTP header to keep the idea of stateless HTTP requests.&lt;br /&gt;
&lt;br /&gt;
== Setup the project ==&lt;br /&gt;
Once the project is successfully created, add the following configurations to your appsettings.json:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;TokenAuthentication&amp;quot;: {&lt;br /&gt;
    &amp;quot;SecretKey&amp;quot;: &amp;quot;secretkey_secretkey123!&amp;quot;,&lt;br /&gt;
    &amp;quot;Issuer&amp;quot;: &amp;quot;DemoIssuer&amp;quot;,&lt;br /&gt;
    &amp;quot;Audience&amp;quot;: &amp;quot;DemoAudience&amp;quot;,&lt;br /&gt;
    &amp;quot;TokenPath&amp;quot;: &amp;quot;/api/token&amp;quot;,&lt;br /&gt;
    &amp;quot;CookieName&amp;quot;: &amp;quot;access_token&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tokens transmission / validation ==&lt;br /&gt;
There are two ways to transmit the authorization tokens:&lt;br /&gt;
* using  HTTP Authorization headers (aka  Bearer authentication);&lt;br /&gt;
* using browser cookies to save the authentication token;&lt;br /&gt;
=== Bearer token validation ===&lt;br /&gt;
The  '''Microsoft.AspNetCore.Authentication.JwtBearer''' package enables you to protect routes by using a JWT Token.&lt;br /&gt;
&lt;br /&gt;
To initialize the Bearer authentication you need to split your Startup.cs file and use another partial class, for example Startup.Auth.cs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
 public partial class Startup&lt;br /&gt;
    {&lt;br /&gt;
        public SymmetricSecurityKey signingKey;&lt;br /&gt;
        private void ConfigureAuth(IApplicationBuilder app)&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
            var signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(Configuration.GetSection(&amp;quot;TokenAuthentication:SecretKey&amp;quot;).Value));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            var tokenValidationParameters = new TokenValidationParameters&lt;br /&gt;
            {&lt;br /&gt;
                // The signing key must match!&lt;br /&gt;
                ValidateIssuerSigningKey = true,&lt;br /&gt;
                IssuerSigningKey = signingKey,&lt;br /&gt;
                // Validate the JWT Issuer (iss) claim&lt;br /&gt;
                ValidateIssuer = true,&lt;br /&gt;
                ValidIssuer = Configuration.GetSection(&amp;quot;TokenAuthentication:Issuer&amp;quot;).Value,&lt;br /&gt;
                // Validate the JWT Audience (aud) claim&lt;br /&gt;
                ValidateAudience = true,&lt;br /&gt;
                ValidAudience = Configuration.GetSection(&amp;quot;TokenAuthentication:Audience&amp;quot;).Value,&lt;br /&gt;
                // Validate the token expiry&lt;br /&gt;
                ValidateLifetime = true,&lt;br /&gt;
                // If you want to allow a certain amount of clock drift, set that here:&lt;br /&gt;
                ClockSkew = TimeSpan.Zero&lt;br /&gt;
            };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            app.UseJwtBearerAuthentication(new JwtBearerOptions&lt;br /&gt;
            {&lt;br /&gt;
                AutomaticAuthenticate = true,&lt;br /&gt;
                AutomaticChallenge = true,&lt;br /&gt;
                TokenValidationParameters = tokenValidationParameters&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Startup.Auth.cs file initialize the Bearer Authentication using  configurations defined in the appsettings.json  file. The tokenValidationParamaters object will be used also by Cookie validation.&lt;br /&gt;
=== Cookies validation ===&lt;br /&gt;
please check reference web site mentioned above ... &lt;br /&gt;
== Token generation ==&lt;br /&gt;
There isn't native support to Token generation in ASP.NET Core, but it is possible write a custom token generator middleware from scratch.&lt;br /&gt;
&lt;br /&gt;
Firstly, you need to create a class which implement token options :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
public class TokenProviderOptions&lt;br /&gt;
    { &lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// The relative request path to listen on.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        /// &amp;lt;remarks&amp;gt;The default path is &amp;lt;c&amp;gt;/token&amp;lt;/c&amp;gt;.&amp;lt;/remarks&amp;gt;&lt;br /&gt;
        public string Path { get; set; } = &amp;quot;/token&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        ///  The Issuer (iss) claim for generated tokens.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        public string Issuer { get; set; }&lt;br /&gt;
&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// The Audience (aud) claim for the generated tokens.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        public string Audience { get; set; }&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// The expiration time for the generated tokens.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        /// &amp;lt;remarks&amp;gt;The default is five minutes (300 seconds).&amp;lt;/remarks&amp;gt;&lt;br /&gt;
        public TimeSpan Expiration { get; set; } = TimeSpan.FromMinutes(5);&lt;br /&gt;
&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// The signing key to use when generating tokens.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        public SigningCredentials SigningCredentials { get; set; }&lt;br /&gt;
&lt;br /&gt;
        /// &amp;lt;summary&amp;gt;&lt;br /&gt;
        /// Resolves a user identity given a username and password.&lt;br /&gt;
        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
        public Func&amp;lt;string, string, Task&amp;lt;ClaimsIdentity&amp;gt;&amp;gt; IdentityResolver { get; set; }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The middleware class will use TokenProviderOptions.cs to generate tokens:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.IdentityModel.Tokens.Jwt;&lt;br /&gt;
using System.Security.Claims;&lt;br /&gt;
using System.Threading.Tasks;&lt;br /&gt;
using Microsoft.AspNetCore.Http;&lt;br /&gt;
using Microsoft.Extensions.Options;&lt;br /&gt;
using Newtonsoft.Json;&lt;br /&gt;
&lt;br /&gt;
namespace CustomTokenAuthProvider&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    public class TokenProviderMiddleware&lt;br /&gt;
    {&lt;br /&gt;
        private readonly RequestDelegate _next;&lt;br /&gt;
        private readonly TokenProviderOptions _options;&lt;br /&gt;
        private readonly JsonSerializerSettings _serializerSettings;&lt;br /&gt;
&lt;br /&gt;
        public TokenProviderMiddleware(&lt;br /&gt;
            RequestDelegate next,&lt;br /&gt;
            IOptions&amp;lt;TokenProviderOptions&amp;gt; options)&lt;br /&gt;
        {&lt;br /&gt;
            _next = next;&lt;br /&gt;
&lt;br /&gt;
            _options = options.Value;&lt;br /&gt;
            ThrowIfInvalidOptions(_options);&lt;br /&gt;
&lt;br /&gt;
            _serializerSettings = new JsonSerializerSettings&lt;br /&gt;
            {&lt;br /&gt;
                Formatting = Formatting.Indented&lt;br /&gt;
            };&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public Task Invoke(HttpContext context)&lt;br /&gt;
        {&lt;br /&gt;
            // If the request path doesn't match, skip&lt;br /&gt;
            if (!context.Request.Path.Equals(_options.Path, StringComparison.Ordinal))&lt;br /&gt;
            {&lt;br /&gt;
                return _next(context);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // Request must be POST with Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
            if (!context.Request.Method.Equals(&amp;quot;POST&amp;quot;)&lt;br /&gt;
               || !context.Request.HasFormContentType)&lt;br /&gt;
            {&lt;br /&gt;
                context.Response.StatusCode = 400;&lt;br /&gt;
                return context.Response.WriteAsync(&amp;quot;Bad request.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            return GenerateToken(context);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private async Task GenerateToken(HttpContext context)&lt;br /&gt;
        {&lt;br /&gt;
            var username = context.Request.Form[&amp;quot;username&amp;quot;];&lt;br /&gt;
            var password = context.Request.Form[&amp;quot;password&amp;quot;];&lt;br /&gt;
&lt;br /&gt;
            var identity = await _options.IdentityResolver(username, password);&lt;br /&gt;
            if (identity == null)&lt;br /&gt;
            {&lt;br /&gt;
                context.Response.StatusCode = 400;&lt;br /&gt;
                await context.Response.WriteAsync(&amp;quot;Invalid username or password.&amp;quot;);&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            var now = DateTime.UtcNow;&lt;br /&gt;
&lt;br /&gt;
            // Specifically add the jti (nonce), iat (issued timestamp), and sub (subject/user) claims.&lt;br /&gt;
            // You can add other claims here, if you want:&lt;br /&gt;
            var claims = new Claim[]&lt;br /&gt;
            {&lt;br /&gt;
                new Claim(JwtRegisteredClaimNames.Sub, username),&lt;br /&gt;
                new Claim(JwtRegisteredClaimNames.Jti, await _options.NonceGenerator()),&lt;br /&gt;
                new Claim(JwtRegisteredClaimNames.Iat, new DateTimeOffset(now).ToUniversalTime().ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64)&lt;br /&gt;
            };&lt;br /&gt;
&lt;br /&gt;
            // Create the JWT and write it to a string&lt;br /&gt;
            var jwt = new JwtSecurityToken(&lt;br /&gt;
                issuer: _options.Issuer,&lt;br /&gt;
                audience: _options.Audience,&lt;br /&gt;
                claims: claims,&lt;br /&gt;
                notBefore: now,&lt;br /&gt;
                expires: now.Add(_options.Expiration),&lt;br /&gt;
                signingCredentials: _options.SigningCredentials);&lt;br /&gt;
            var encodedJwt = new JwtSecurityTokenHandler().WriteToken(jwt);&lt;br /&gt;
&lt;br /&gt;
            var response = new&lt;br /&gt;
            {&lt;br /&gt;
                access_token = encodedJwt,&lt;br /&gt;
                expires_in = (int)_options.Expiration.TotalSeconds&lt;br /&gt;
            };&lt;br /&gt;
&lt;br /&gt;
            // Serialize and return the response&lt;br /&gt;
            context.Response.ContentType = &amp;quot;application/json&amp;quot;;&lt;br /&gt;
            await context.Response.WriteAsync(JsonConvert.SerializeObject(response, _serializerSettings));&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private static void ThrowIfInvalidOptions(TokenProviderOptions options)&lt;br /&gt;
        {&lt;br /&gt;
            if (string.IsNullOrEmpty(options.Path))&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.Path));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (string.IsNullOrEmpty(options.Issuer))&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.Issuer));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (string.IsNullOrEmpty(options.Audience))&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.Audience));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (options.Expiration == TimeSpan.Zero)&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentException(&amp;quot;Must be a non-zero TimeSpan.&amp;quot;, nameof(TokenProviderOptions.Expiration));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (options.IdentityResolver == null)&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.IdentityResolver));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (options.SigningCredentials == null)&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.SigningCredentials));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (options.NonceGenerator == null)&lt;br /&gt;
            {&lt;br /&gt;
                throw new ArgumentNullException(nameof(TokenProviderOptions.NonceGenerator));&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The TokenProviderMiddleware class implements the Invoke method to generate tokens by using the TokenProviderOptions. In order to initialize the middleware, it is necessary to modify the '''Startup.Auth.cs''' file and add in the '''ConfigureAuth''' method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Security.Claims;&lt;br /&gt;
using System.Security.Principal;&lt;br /&gt;
using System.Threading.Tasks;&lt;br /&gt;
using CustomTokenAuthProvider;&lt;br /&gt;
using Microsoft.AspNetCore.Builder;&lt;br /&gt;
using Microsoft.IdentityModel.Tokens;&lt;br /&gt;
using Microsoft.Extensions.Options;&lt;br /&gt;
&lt;br /&gt;
namespace Blog.TokenAuthGettingStarted&lt;br /&gt;
{&lt;br /&gt;
    public partial class Startup&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        private void ConfigureAuth(IApplicationBuilder app)&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
            var signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(Configuration.GetSection(&amp;quot;TokenAuthentication:SecretKey&amp;quot;).Value));&lt;br /&gt;
            // This part to be added&lt;br /&gt;
            var tokenProviderOptions = new TokenProviderOptions&lt;br /&gt;
            {&lt;br /&gt;
                Path = Configuration.GetSection(&amp;quot;TokenAuthentication:TokenPath&amp;quot;).Value,&lt;br /&gt;
                Audience = Configuration.GetSection(&amp;quot;TokenAuthentication:Audience&amp;quot;).Value,&lt;br /&gt;
                Issuer = Configuration.GetSection(&amp;quot;TokenAuthentication:Issuer&amp;quot;).Value,&lt;br /&gt;
                SigningCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256),&lt;br /&gt;
                IdentityResolver = GetIdentity&lt;br /&gt;
            };&lt;br /&gt;
&lt;br /&gt;
            var tokenValidationParameters = new TokenValidationParameters&lt;br /&gt;
            {&lt;br /&gt;
                // The signing key must match!&lt;br /&gt;
                ValidateIssuerSigningKey = true,&lt;br /&gt;
                IssuerSigningKey = signingKey,&lt;br /&gt;
                // Validate the JWT Issuer (iss) claim&lt;br /&gt;
                ValidateIssuer = true,&lt;br /&gt;
                ValidIssuer = Configuration.GetSection(&amp;quot;TokenAuthentication:Issuer&amp;quot;).Value,&lt;br /&gt;
                // Validate the JWT Audience (aud) claim&lt;br /&gt;
                ValidateAudience = true,&lt;br /&gt;
                ValidAudience = Configuration.GetSection(&amp;quot;TokenAuthentication:Audience&amp;quot;).Value,&lt;br /&gt;
                // Validate the token expiry&lt;br /&gt;
                ValidateLifetime = true,&lt;br /&gt;
                // If you want to allow a certain amount of clock drift, set that here:&lt;br /&gt;
                ClockSkew = TimeSpan.Zero&lt;br /&gt;
            };&lt;br /&gt;
          &lt;br /&gt;
            app.UseJwtBearerAuthentication(new JwtBearerOptions&lt;br /&gt;
            {&lt;br /&gt;
                AutomaticAuthenticate = true,&lt;br /&gt;
                AutomaticChallenge = true,&lt;br /&gt;
                TokenValidationParameters = tokenValidationParameters&lt;br /&gt;
            });&lt;br /&gt;
            /*&lt;br /&gt;
            app.UseCookieAuthentication(new CookieAuthenticationOptions&lt;br /&gt;
            {&lt;br /&gt;
                AutomaticAuthenticate = true,&lt;br /&gt;
                AutomaticChallenge = true,&lt;br /&gt;
                AuthenticationScheme = &amp;quot;Cookie&amp;quot;,&lt;br /&gt;
                CookieName = Configuration.GetSection(&amp;quot;TokenAuthentication:CookieName&amp;quot;).Value,&lt;br /&gt;
                TicketDataFormat = new CustomJwtDataFormat(&lt;br /&gt;
                    SecurityAlgorithms.HmacSha256,&lt;br /&gt;
                    tokenValidationParameters)&lt;br /&gt;
            });&lt;br /&gt;
           */&lt;br /&gt;
&lt;br /&gt;
          app.UseMiddleware&amp;lt;TokenProviderMiddleware&amp;gt;(Options.Create(tokenProviderOptions));&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private Task&amp;lt;ClaimsIdentity&amp;gt; GetIdentity(string username, string password)&lt;br /&gt;
        {&lt;br /&gt;
            // DEMO CODE, DON NOT USE IN PRODUCTION!!!&lt;br /&gt;
            if (username == &amp;quot;TEST&amp;quot; &amp;amp;&amp;amp; password == &amp;quot;TEST123&amp;quot;)&lt;br /&gt;
            {&lt;br /&gt;
                return Task.FromResult(new ClaimsIdentity(new GenericIdentity(username, &amp;quot;Token&amp;quot;), new Claim[] { }));&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // Account doesn't exists&lt;br /&gt;
            return Task.FromResult&amp;lt;ClaimsIdentity&amp;gt;(null);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The '''tokenProviderOptions''' defines the options of the token generator. The '''IdentityResolver''' is the Task method which will check the identity of users. For demo purposes, the '''IdentityResolver''' is implemented by a simple method called '''GetIdentity'''.&lt;br /&gt;
== Final Steps ==&lt;br /&gt;
Now is possible call the ConfigureAuth method inside the Startup.cs file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)&lt;br /&gt;
        {&lt;br /&gt;
           loggerFactory.AddConsole(Configuration.GetSection(&amp;quot;Logging&amp;quot;));&lt;br /&gt;
            loggerFactory.AddDebug();&lt;br /&gt;
&lt;br /&gt;
            ConfigureAuth(app);&lt;br /&gt;
&lt;br /&gt;
            app.UseMvc();&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting token ==&lt;br /&gt;
You can obtain the JWT token by calling the following route /api/token/ using POST and passing the username and password data:&lt;br /&gt;
 POST api/token&lt;br /&gt;
 Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
 username=TEST&amp;amp;password=TEST123&lt;br /&gt;
== Authorize controllers ==&lt;br /&gt;
All controllers decorated by the attribute '''[Authorize]''' are protected by the JWT authentication.&lt;br /&gt;
In each http call you need to pass the access_token parmeter:&lt;br /&gt;
 http://hostname/controller/route?access_token=MY_TOKEN&lt;br /&gt;
The demo code is available on [https://github.com/samueleresca/Blog.TokenAuthGettingStarted Github.]&lt;/div&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	</feed>