2016-12-27 13 views
0

我的資源服務器使用Oauth2進行身份驗證。我們使用谷歌來驗證用戶。所以基本上谷歌被用作認證服務器。 'tegile'在驗證時用作域。如何使用oauth2.0撥打其他電話

從Google獲取無記名令牌的方式是什麼?我可以將其作爲REST頭的一部分傳遞給我的資源服務器?

回答

0

這裏是你如何使用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; 
}