在 Azure webapp 服务器中获取 Google Plus 用户 access_token
Get Google Plus user access_token in Azure webapp server
我已经使用 Express 运行 Node.JS 成功设置了 Azure webapp,并使用内置的 Azure Google "Authentication / Authorization" 添加了 Google Plus 身份验证.身份验证过程使用 SSL 工作得很好,我能够对用户进行身份验证。
现在,
我知道身份验证进程正在与用户 access_token 一起调用 https://mysite.azurewebsites.net/.auth/login/google/callback 以供将来 API 调用,但在这种情况下是 Azure "intercepts" 它(而不是通常会发生的情况 - 我会得到它在我赢得的服务器上)。
问题是 - 为什么要在服务器上获取和使用此令牌?
我已经尝试添加到 .auth/login/google/callback 的路由,有人得到了代码
router.get('/.auth/login/google/callback', function (req, res, next) {
console.log("CALLBACK");
next();
});
无果...
来自 google+ 的授权信息将在请求 headers 中设置。如果您在路由器函数中列出您的请求 headers,例如:
res.send(JSON.stringify(req.headers));
您可以在前缀为 x-ms-token-google-
的 headers 中设置身份验证信息。
详情请参阅https://azure.microsoft.com/en-us/documentation/articles/app-service-api-authentication/。
同时,您可以简单地向站点上的 /.auth/me 端点发出 GET 以检索其他用户信息以及图形调用所需的任何令牌。详见https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/。
我已经使用 Express 运行 Node.JS 成功设置了 Azure webapp,并使用内置的 Azure Google "Authentication / Authorization" 添加了 Google Plus 身份验证.身份验证过程使用 SSL 工作得很好,我能够对用户进行身份验证。
现在, 我知道身份验证进程正在与用户 access_token 一起调用 https://mysite.azurewebsites.net/.auth/login/google/callback 以供将来 API 调用,但在这种情况下是 Azure "intercepts" 它(而不是通常会发生的情况 - 我会得到它在我赢得的服务器上)。
问题是 - 为什么要在服务器上获取和使用此令牌?
我已经尝试添加到 .auth/login/google/callback 的路由,有人得到了代码
router.get('/.auth/login/google/callback', function (req, res, next) {
console.log("CALLBACK");
next();
});
无果...
来自 google+ 的授权信息将在请求 headers 中设置。如果您在路由器函数中列出您的请求 headers,例如:
res.send(JSON.stringify(req.headers));
您可以在前缀为 x-ms-token-google-
的 headers 中设置身份验证信息。
详情请参阅https://azure.microsoft.com/en-us/documentation/articles/app-service-api-authentication/。
同时,您可以简单地向站点上的 /.auth/me 端点发出 GET 以检索其他用户信息以及图形调用所需的任何令牌。详见https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/。