Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc owin google auth与mvc5_Asp.net Mvc_Api_Owin_Google Plus Signin - Fatal编程技术网

Asp.net mvc owin google auth与mvc5

Asp.net mvc owin google auth与mvc5,asp.net-mvc,api,owin,google-plus-signin,Asp.net Mvc,Api,Owin,Google Plus Signin,我创建了一个新的mvc5标准项目。 我编辑了Startup.Auth.cs,添加了: app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() { ClientId = "myClientCode.apps.googleusercontent.com", ClientSecret = "myClientSecret" }); 和web.config添加: <location pa

我创建了一个新的mvc5标准项目。 我编辑了Startup.Auth.cs,添加了:

 app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
 {
      ClientId = "myClientCode.apps.googleusercontent.com",
      ClientSecret = "myClientSecret"
 });
和web.config添加:

 <location path="signin-google">
     <system.web>
          <authorization>
               <allow users="*" />
          </authorization>
     </system.web>
</location>
是空的

accounts.google.com生成的回调如下:

 http://localhost:58053/signin-google?state=K0Q6LHytGsRTpArK9TruwwzurLNbS4JeK30LEYhMmuaH9vmh3zQslFUA0dqByxftJlCBd6NhxyK12Co-2rKjBX711-WTfUNXKajPSKmpc7PiwwqBFwrnhMvUFh6f0b9iHTO4DU0EwBBBiYEDPkpvGsc--oTjTzzqf2qcpNLjScj9Hg6Obxm8tbHBcbO5CJcDxQtMWf8bOJ6bjVihqJwJ270Ps5SGfB9IRdxqJbVlIrM&code=4/tnXrYTNPuoTdZZmT29fWCWoE63_1HEa9g0lCrOi_vo8&authuser=1&session_state=3a5578d289d23d09dac97e705ebc613f4599f92b..d2d9&prompt=none
看起来还可以

你知道我可以使用owin检索帐户数据吗

HttpContext.GetOwinContext().Authentication.GetExternalLoginInfoAsync();
 http://localhost:58053/signin-google?state=K0Q6LHytGsRTpArK9TruwwzurLNbS4JeK30LEYhMmuaH9vmh3zQslFUA0dqByxftJlCBd6NhxyK12Co-2rKjBX711-WTfUNXKajPSKmpc7PiwwqBFwrnhMvUFh6f0b9iHTO4DU0EwBBBiYEDPkpvGsc--oTjTzzqf2qcpNLjScj9Hg6Obxm8tbHBcbO5CJcDxQtMWf8bOJ6bjVihqJwJ270Ps5SGfB9IRdxqJbVlIrM&code=4/tnXrYTNPuoTdZZmT29fWCWoE63_1HEa9g0lCrOi_vo8&authuser=1&session_state=3a5578d289d23d09dac97e705ebc613f4599f92b..d2d9&prompt=none