В настоящее время я использую реагировать нативно и реактивно-нативно-Google-Signin (https://github.com/react-native-community/react-native-google-signin)
Я разрабатываю приложение, которое регистрируется на канале YouTube с использованием "https://www.googleapis.com/auth/youtube" scope. Я хочу получить идентификатор канала YouTube (не идентификатор, который он возвращает после входа в систему", поэтому я попытался получить API данных YouTube и получить " мой = истинный "канал
Вот мой код
signIn = async () => {
try{
await GoogleSignin.hasPlayServices({autoResolve: true});
await GoogleSignin.signIn()
.then(res=>{
console.log(res)
fetch("https://www.googleapis.com/youtube/v3/channels?part=snippet,statistic&mine=true&key=[API_KEY]")
.then(res => res.json())
.then(res => {
console.log(res)
})
})
Ожидаемое поведение
Он вернет данные пользователя канала, просто войдя в систему.
Фактическое поведение
{
"error": Object {
"code": 401,
"errors": Array [
Object {
"domain": "youtube.parameter",
"location": "mine",
"locationType": "parameter",
"message": "The request uses the <code>mine</code> parameter but is not properly authorized.",
"reason": "authorizationRequired",
},
],
"message": "The request uses the <code>mine</code> parameter but is not properly authorized.",
},
}
Окружающая среда
response-native: 0.57.1react-native-google-signin: 1.2.1