admin管理员组文章数量:1336133
I'm trying to authenticate with google in a Flutter Web project, and I have something like this
final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: <String>[
'email',
],
);
Future<void> test() async {
try {
await _googleSignIn.signOut();
GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
} catch (e) {
print(e);
}
}
I'm just doing so and Google pop up appears, but when I select account I receive this response
{"access_token":"<redacted>","token_type"
:"Bearer","expires_in":3598,"scope":"email profile
.profile openid
.email","authuser":"0","prompt":"none"}
and this error
[GSI_LOGGER-TOKEN_CLIENT]: Trying to set gapi client token.
[GSI_LOGGER-TOKEN_CLIENT]: The OAuth token was not passed to gapi.client, since the
gapi.client library is not loaded in your page.
ClientException: {
"error": {
"code": 403,
"message": "People API has not been used in project proyectId before or it is
disabled. Enable it by visiting
.googleapis/overview?
project=proyectId then retry. If you
enabled this API recently, wait a few minutes for the action to propagate to our
systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url":
".googleapis/overview?
project=proyectId"
}
]
},
{
"@type": "type.googleapis/google.rpc.ErrorInfo",
"reason": "SERVICE_DISABLED",
"domain": "googleapis",
"metadata": {
"service": "people.googleapis",
"consumer": "projects/proyectId"
}
}
]
}
}
I already added meta tag in index.html
<meta name="google-signin-client_id" content="googleProyectId" />
So i dont know if I'm missing something
I'm trying to authenticate with google in a Flutter Web project, and I have something like this
final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: <String>[
'email',
],
);
Future<void> test() async {
try {
await _googleSignIn.signOut();
GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
} catch (e) {
print(e);
}
}
I'm just doing so and Google pop up appears, but when I select account I receive this response
{"access_token":"<redacted>","token_type"
:"Bearer","expires_in":3598,"scope":"email profile
https://www.googleapis/auth/userinfo.profile openid
https://www.googleapis/auth/userinfo.email","authuser":"0","prompt":"none"}
and this error
[GSI_LOGGER-TOKEN_CLIENT]: Trying to set gapi client token.
[GSI_LOGGER-TOKEN_CLIENT]: The OAuth token was not passed to gapi.client, since the
gapi.client library is not loaded in your page.
ClientException: {
"error": {
"code": 403,
"message": "People API has not been used in project proyectId before or it is
disabled. Enable it by visiting
https://console.developers.google/apis/api/people.googleapis/overview?
project=proyectId then retry. If you
enabled this API recently, wait a few minutes for the action to propagate to our
systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url":
"https://console.developers.google/apis/api/people.googleapis/overview?
project=proyectId"
}
]
},
{
"@type": "type.googleapis/google.rpc.ErrorInfo",
"reason": "SERVICE_DISABLED",
"domain": "googleapis",
"metadata": {
"service": "people.googleapis",
"consumer": "projects/proyectId"
}
}
]
}
}
I already added meta tag in index.html
<meta name="google-signin-client_id" content="googleProyectId" />
So i dont know if I'm missing something
Share Improve this question edited Nov 22, 2024 at 17:22 PatrickdC 2,5312 gold badges8 silver badges29 bronze badges asked Nov 19, 2024 at 22:59 Erick GalvánErick Galván 387 bronze badges 1- Are you still getting the same message even after enabling the People API in your Google Cloud Console? – Saddles Commented Nov 20, 2024 at 15:22
1 Answer
Reset to default 0Reading the docs, i realize that in Flutter Web the signIn method should not be used and will be deprecated, it is better to use a mix of signInSilently method, but it sometimes fails if user closes it once and it doesn't open anymore (for security i guess).
Another way they recommend it's to use their renderButton, it works, but it's not customizable.
In my case, I'm using Firebase, so i did it this way
FirebaseAuth.instance.signInWithPopup(GoogleAuthProvider());
Of course i need to have previous firebase config.
However, i think that they should improve a real alternative for signIn()
本文标签: flutterPeople Api has not been used in this projectStack Overflow
版权声明:本文标题:flutter - People Api has not been used in this project - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742393632a2466480.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论