title: Handle OAuth 2.0 Authentication - Get token redirect token response in ASP.NET MVC application
body: <p>I recently started fiddling with OneDrive API which uses OAuth 2.0 authentication / authorization flow.</p>
  
  <p><a href="https://github.com/OneDrive/onedrive-api-docs/blob/master/auth/msa_oauth.md" rel="nofollow">OneDrive API OAuth 2.0</a></p>
  
  <p>I am trying to follow along the <code>Token Flow</code> to get access token using an ASP.NET MVC Application.</p>
  
  <p>The request I make is something similar to the following:</p>
  
  <p><code>GET https://login.live.com/oauth20_authorize.srf?client_id={client_id}&amp;scope={scope}&amp;response_type=token&amp;redirect_uri={redirect_uri}</code></p>
  
  <p>On successful authorization from the user the web browser will be redirected to your redirect URL with additional parameters <strong>added to the URL</strong>.</p>
  
  <p>The redirect URL is similar to the following:
  <code>https://login.live.com/oauth20_authorize.srf#access_token={access_token}&amp;authentication_token={authentication_token}&amp;token_type=bearer&amp;expires_in=3600&amp;scope=onedrive.info%20onedrive.full&amp;user_id={user_id}</code></p>
  
  <p>Notice the <code>#</code> in the above format URL. This is as per specification of OAuth 2.0 protocol standards.</p>
  
  <p><strong>Question:</strong> If I have a redirect URL to handle in my MVC application which has query parameters section starting with <code>?</code> then it can be handled very easily using a controller's action with proper input parameters mapping the query string key / values.</p>
  
  <p>How can I handle a URL in my MVC application that has query string section starting with <code>#</code> and get all query string key / values from it?</p>
  
  <p><strong>Side note:</strong> I would request not to suggest using any third party API / Libraries / Routines in this case. Considering the fact that I wish to do the OAuth process plain and simple way. Thanks</p>