使用 google 按钮更改登录标签
change label of sign in with google button
我制作了一个“使用 google 登录”按钮,但我只想将其文本更改为“使用 google 注册”什么都没有否则,但我想更改标签,请帮忙!
这是我的代码:
<!doctype html>
<html>
<head>
<meta name="google-signin-client_id" content="xxxxx
.apps.googleusercontent.com">
</head>
<body>
<div id="my-signin2"></div>
<script>
function onSuccess(googleUser) {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut();
}//end of googleSignIn
function onFailure(error) {
console.log(error);
}
//custom google button
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 245,
'height': 40,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>
<script src="https://apis.google.com/js/platform.js?
onload=renderButton" async defer></script>
</body>
</html>
在 HTML 中使用
data-text 属性。设置 data-text="signup_with"
将按照您的要求呈现一个名为“使用 Google 注册”的按钮。
与您的代码片段中显示的旧库一样,新按钮支持 JavaScript 回调处理程序或后端服务器重定向,后者在用户登录后共享 ID 令牌凭据。
我制作了一个“使用 google 登录”按钮,但我只想将其文本更改为“使用 google 注册”什么都没有否则,但我想更改标签,请帮忙! 这是我的代码:
<!doctype html>
<html>
<head>
<meta name="google-signin-client_id" content="xxxxx
.apps.googleusercontent.com">
</head>
<body>
<div id="my-signin2"></div>
<script>
function onSuccess(googleUser) {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut();
}//end of googleSignIn
function onFailure(error) {
console.log(error);
}
//custom google button
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 245,
'height': 40,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>
<script src="https://apis.google.com/js/platform.js?
onload=renderButton" async defer></script>
</body>
</html>
在 HTML 中使用
data-text 属性。设置 data-text="signup_with"
将按照您的要求呈现一个名为“使用 Google 注册”的按钮。
与您的代码片段中显示的旧库一样,新按钮支持 JavaScript 回调处理程序或后端服务器重定向,后者在用户登录后共享 ID 令牌凭据。