1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Nativescript (V8.8) with Angular (V18) and plugin google-signin throws always Error: 10

Discussão em 'Angular' iniciado por user1640506, Outubro 15, 2024 às 16:13.

  1. user1640506

    user1640506 Guest

    I am currently developing a mobile app using the NativeScript framework, version 8.8, and Angular version 18 for the frontend.

    I want to implement user authentication using the "google-signin" plugin. The documentation for the plugin can be found here: https://docs.nativescript.org/plugins/google-signin

    For Android, I have already set up a Firebase project and registered my app there. I also generated an SHA-1 fingerprint for my local keystore using the following command:

    keytool -list -v \
    -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore


    I used "android" as the password, as recommended. I added the SHA-1 fingerprint to my Firebase project under the Android app settings. I also created an OAuth app in the Google Cloud Console and set up the OAuth consent screen accordingly.

    Here's what I have in my app:

    In the HTML file of my component, I added the Google Sign-In button:

    <FlexboxLayout flexDirection="column" class="page">
    <GoogleSignInButton
    colorScheme='auto'
    colorStyle='standard'
    (tap)="yourGoogleSigninFunction()">
    </GoogleSignInButton>
    </FlexboxLayout>


    The component's controller looks like this:

    import { Component } from "@angular/core";
    import { Color, Page } from "@nativescript/core";
    import { GoogleSignin } from "@nativescript/google-signin";

    @Component({
    selector: "ns-users",
    templateUrl: "./users.component.html",
    styleUrls: ["./users.component.scss"],
    })
    export class UsersComponent {
    constructor(page: Page) {
    page.actionBarHidden = true;
    page.androidStatusBarBackground = new Color("#cc9e26");
    }

    async yourGoogleSigninFunction() {
    console.log("yourGoogleSigninFunction");
    try {
    console.log("try");
    await GoogleSignin.configure({});
    console.log("configure");
    const user = await GoogleSignin.signIn();
    console.log("user", user);
    } catch (e) {
    console.error(e);
    }
    }
    }


    The issue:

    When I start the app and click the Google Sign-In button, the usual Google Sign-In window opens, and I can log in successfully. However, after signing in, the console shows the following error:

    Error: 10:


    I'm testing on an Android emulator running Android 14 with Google Services.

    How can I resolve this issue? Is there any way to further trace or identify the error? I’m stuck and appreciate any help.

    Thank you!

    Continue reading...

Compartilhe esta Página