我正在使用 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
我刚刚在我的 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)