【发布时间】:2016-12-27 17:10:30
【问题描述】:
我的资源服务器使用 Oauth2 进行身份验证。我们使用 google 对用户进行身份验证。所以基本上谷歌被用作身份验证服务器。 'tegile' 在身份验证时用作域。
有什么方法可以从 Google 获取不记名令牌,我可以将其作为 REST 标头的一部分传递给我的资源服务器?
【问题讨论】:
标签: rest oauth-2.0 google-oauth google-authentication
我的资源服务器使用 Oauth2 进行身份验证。我们使用 google 对用户进行身份验证。所以基本上谷歌被用作身份验证服务器。 'tegile' 在身份验证时用作域。
有什么方法可以从 Google 获取不记名令牌,我可以将其作为 REST 标头的一部分传递给我的资源服务器?
【问题讨论】:
标签: rest oauth-2.0 google-oauth google-authentication
以下是如何使用Google's Sign-In button 模板来初始化登录和授予权限的过程:
<meta name="google-signin-client_id" content="{{ OAUTH2_CLIENT_ID }}">
<script src="https://apis.google.com/js/platform.js?onload=onLoad" async defer></script>
<div id="google-signin-button"
class="g-signin2"
data-width="170"
data-height="30"
data-onsuccess="onSignIn"
data-onfailure="onSignInFailure">
</div>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
var idToken = googleUser.getAuthResponse().id_token;
}
【讨论】: