我正在重构我的“使用 Google 登录”,将其替换gapi为gsion http://localhost:8080。
声称如何才能gapi毫无问题地工作。gsiThe given origin is not allowed for the given client ID
<script src="https://apis.google.com/js/api:client.js" async defer></script>
Run Code Online (Sandbox Code Playgroud)
<script src="https://apis.google.com/js/api:client.js" async defer></script>
Run Code Online (Sandbox Code Playgroud)
<script src="https://accounts.google.com/gsi/client" async defer></script>
Run Code Online (Sandbox Code Playgroud)
window.gapi.load('auth2', () => {
const auth2 = window.gapi.auth2.init({ client_id })
auth2.signIn().then(console.log)
})
Run Code Online (Sandbox Code Playgroud)
错误如下:The given origin is not allowed for the given client ID
我从https://developers.google.com/identity/gsi/web/guides/personalized-button添加了“使用 Google 登录”按钮
此上下文添加width到 iframe 内部的元素样式。我知道按照规范 Google 按钮应该在 40-400px 范围内。我想制作页面容器max-width: 400px,但这个按钮根本无法与容器一起缩放。
我是否必须使用 JavaScript 来更新data-width属性,或者是否有 CSS 的正常解决方案?
<div class="g_id_signin" data-width="400" />
Run Code Online (Sandbox Code Playgroud) .valueOf()and方法.toString()?export default class Measure extends Number implements Number {
public symbol = ''
constructor(value: number | string | Measure, symbol?: string) {
super(value)
if (symbol) {
this.symbol = symbol
}
}
public valueOf = (): number => {
return parseFloat(this.toPrecision(12))
}
public toString = (): string => {
return String(this.valueOf()) + this.symbol
}
}
Run Code Online (Sandbox Code Playgroud)
.valueOf().toString()import Measure from '../src/testing'
describe('Measure …Run Code Online (Sandbox Code Playgroud)