Javascript 如何在服务器端验证gmail访问令牌
我想验证服务器上的gmail访问令牌 (即在控制器的作用下)。 我可以通过以下代码获得访问令牌:Javascript 如何在服务器端验证gmail访问令牌,javascript,jquery,model-view-controller,c#-4.0,google-oauth,Javascript,Jquery,Model View Controller,C# 4.0,Google Oauth,我想验证服务器上的gmail访问令牌 (即在控制器的作用下)。 我可以通过以下代码获得访问令牌: now I want to validate this access_token (received by onSignIn function) by c# code on sever side. I am sending email id & access_token to the sever by ajax call. i have no idea what to do next
now I want to validate this access_token (received by onSignIn
function) by c# code on sever side.
I am sending email id & access_token to the sever by ajax call.
i have no idea what to do next , please help me. Thanks in advance
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
idToken = googleUser.Zi.access_token
id = profile.getId();
console.log('ID: ' + profile.getId());
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
ValidateAccessToken(id, idToken);
}
您应该在对Google登录进行身份验证时阅读此内容backend@user1538301我读过了。我想要在服务器端的c代码中验证令牌,我无法找到任何解决方案。谢谢你的回答。威尔,有很多方法可以做到。您需要知道如何在C#中进行API/HTTP调用,以及如何以同步的方式处理其响应(至少对于请求的上下文而言),以便可以在控制器操作中进行API调用,并从Google的响应生成响应。从查找如何在C#或.NET中进行API/HTTP调用开始(这里是我刚刚通过搜索“如何在C#.NET中进行HTTP调用”找到的一个示例)