小编sub*_*amX的帖子

Google Identity Service Oauth2 检测同意弹出窗口是否关闭

我正在使用 Google 身份服务,并面临一些问题。看一下下面的函数loginUser并得到access_token

const client = (window as any).google.accounts.oauth2.initTokenClient({
  client_id: process.env.GOOGLE_CLIENT_ID,
  scope: `profile email`,
  callback: '' // defined at request time
});

const loginUser = async () => {
  const tokenResponse = await new Promise<TokenResponse>((resolve, reject) => {
    try {
      // Settle this promise in the response callback for requestAccessToken()
      client.callback = (resp) => {
        if (resp.error !== undefined) {
          reject(resp);
        }
        resolve(resp);
      };
      // requesting access token
      client.requestAccessToken({ prompt: 'consent' });
    } catch (err) { …
Run Code Online (Sandbox Code Playgroud)

javascript google-oauth google-signin google-identity react-google-login

7
推荐指数
2
解决办法
3220
查看次数

Git bash 和 WSL 有什么区别

我刚刚在我的 Windows 机器上安装了 Git SCM。我的机器之前安装了 Node。我可以在 git bash 中使用 node -v 。但是,为什么我能够在 Git Bash 中而不是在 WSL Bash 中使用 Windows 应用程序。

WSL Bash 内幕-

hello@comp:~$ node -v

Command 'node' not found, but can be installed with:

sudo apt install nodejs
Run Code Online (Sandbox Code Playgroud)

Git Bash 内幕-

hello@comp MINGW64 
$ node -v
v12.10.0
Run Code Online (Sandbox Code Playgroud)

git bash git-bash windows-subsystem-for-linux

6
推荐指数
2
解决办法
3110
查看次数