Google OAuth2 - 400: отсутствует тип response_type, но вставка URL в браузер работает. Что дает? - PullRequest
0 голосов
/ 10 апреля 2020

В моем коде ниже я получаю следующую ошибку:

Error 400 - Error: invalid_request. Required parameter is missing: response_type

Но когда я вставляю URL в свой браузер, я получаю экран, чтобы выбрать, какую учетную запись Google разрешить разрешения для. Почему код не работает?

const http = require('http');
const open = require('open');

const authorizeUrl = `
https://accounts.google.com/o/oauth2/v2/auth?
access_type=offline&
response_type=code&
scope=https://www.googleapis.com/auth/youtube&
client_id=<myclientId>&
redirect_uri=http://localhost:3000
`;

const server = http.createServer(async (req, res) => { })
.listen(3000, () => {
    console.log('listening to server 3000'); 
    open(authorizeUrl);
});
...