Why is the "Confirm your choices" prompt appearing twice when utilizing the cordova google-plus plugin?

let params;
    if(this.platform.is('android')){
      params = {
        'webClientId': '77852...client id stuff..',
        'offline': true
      }
    }
    else{
      params={}
    }

this.googlePlus.login(params)
    .then(res => {
      console.log(res);
}
)
.catch(err => console.error(err));

This code snippet is crucial for my project. Upon running this code, a specific sequence of events occurs:

Initially, the user is prompted to select a Google Account to proceed. Subsequently, a confirmation message appears, prompting the user to allow access. However, after clicking 'allow', the same confirmation dialog reappears. Only after confirming the choice again does the iDToken finally get generated.

I am puzzled as to why the identical confirmation prompt appears twice in succession. Any insights would be greatly appreciated.

Answer №1

If you're only using it for login purposes (and don't need any serverAuthCode), make sure to include 'offline': false

let options; if(this.platform.is('android')){ options = { 'webClientId': '77852...client id stuff..', 'offline': false } } else{ options={} }

this.googlePlus.login(options) .then(response => { console.log(response); } ) .catch(error => console.error(error));

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the world of Ajax requests within Android phonegap applications

Initially, my project using Dojo worked flawlessly with PhoneGap 2.7.0. However, upon upgrading to PhoneGap 3.0, none of the ajax requests appear to be going through. To rule out Dojo as a factor, I created a basic test page using plain JavaScript, but un ...

Experiencing difficulties incorporating $cordovaSocialSharing into the controller due to an error

I have successfully developed a hybrid app using the Ionic framework. To enable social sharing functionality within my app, I integrated the cordovaSocialShare plugin from NgCordova. After executing the command cordova plugin add <a href="https://github ...

Utilizing Angular 2 for Element Selection and Event Handling

function onLoaded() { var firstColumnBody = document.querySelector(".fix-column > .tbody"), restColumnsBody = document.querySelector(".rest-columns > .tbody"), restColumnsHead = document.querySelector(".rest-columns > .thead"); res ...

Implementing Angular 2 reactive forms checkbox validation in an Ionic application

I have implemented Angular Forms to create a basic form with fields for email, password, and a checkbox for Terms&Conditions in my Ionic application. Here is the HTML code: <form [formGroup]="registerForm" (ngSubmit)="register()" class="center"> ...

"Utilize Typescript to create a function within a nested object structure

I have a scenario where I am trying to access the foo variable inside the function a of the test object. class bar { private foo: string = "foobar"; constructor() { /* ... Implementation ... */ } fncA(): this { // ... implementation ...

Obtain accurate dispatch type by leveraging ConnectedProps in conjunction with redux-thunk

Currently, I am utilizing Redux-Toolkit and Typescript. Specifically, my goal is to implement ConnectedProps as recommended in the redux documentation. However, it appears that the dispatch type is not recognized correctly (it is identified as a normal Dis ...

What is the best way to incorporate resources from a different location in an Angular project?

I am facing an issue with the deployment time of my server as I am using @angular/localize to support three languages in my application. Despite all locales sharing the same assets, they are being downloaded and deployed individually for each one. To addr ...

Utilizing express-session in TypeScript: Incorporating user information into the session

Hey, I'm currently working on implementing express-session and connect-mongodb-session in my TypeScript Express/Node API. My goal is to use express-session to create a cookie for logged-in users and automatically persist that cookie to MongoDB. Howeve ...

Display the pre-selected option in mat-select in an Angular application

Need help with displaying the selected option in mat-select using Angular 11. The scenario is as follows: I have a field named Idefault, and the condition is, if type.Idefault == true, then show the value as the selected option in mat-select. An image has ...

Printing values of an object in an Angular/HTML script is proving to be quite challenging for me

In my Angular project, I have created a service and component for listing objects. The list is functioning correctly as I have tested it with 'console.log()'. However, when I try to display the list on localhost:4200, nothing appears. <table&g ...

How to configure VSCode for automatically transpiling TypeScript and launching NodeJS debugger with just one press of the F5 key?

Working with VSCode+TypeScript+NodeJS can feel overly complex compared to a C# project in Visual Studio. Just hitting F5 in C# compiles the project and initiates debugging. How can I configure VSCode to do the same for TypeScript+NodeJS? What am I missing ...

AmCharts issue in NextJS - Unusual SyntaxError: Unexpected token 'export' detected

Encountered an error while trying to utilize the '@amcharts/amcharts4/core' package and other amchart modules in a NextJS project: SyntaxError: Unexpected token 'export' After searching through various resources, I came across a helpf ...

Guide to creating JSDoc for a TouchEvent handler

Looking to improve my shorter-js codebase with JSDoc for TypeScript definitions, but hitting a roadblock. I've implemented the on() function using Element.addEventListener, working well so far. However, when passing a TouchEvent as a parameter for an ...

Leveraging the Parameters utility type in Typescript for enhanced functionality

My attempt to utilize Parameters<> in order to mimic a function with a wrapper function seems to be facing some challenges. I had high hopes for the code below, but it's not working as expected. The "spawn" method has multiple overloads, and I a ...

Utilize a combination of generic parameters as the keys for objects in TypeScript

Is there a method to utilize multiple generic parameters as object keys in TypeScript? I came across this answer which works well when there is only one parameter, but encounters issues with more than one. The error message "A mapped type may not declar ...

Develop a function that returns a specific type that has been mapped

I'm currently working on a method that loops through an object and replaces key-value pairs where the value matches { _id: Types.ObjectId } with a new key and maps the value to the string representation of _id. For example: { "name": " ...

What impact does introducing a constraint to a generic type have on the inference process?

Let's take a look at this scenario: function identity<T>(arr: T[]) { return arr } identity(["a", "b"]) In the above code snippet, the generic type T is inferred as string, which seems logical. However, when we introduce a ...

typescript: understanding how to deduce an array in a union rather than multiple arrays

Consider a scenario where we have a function called toArray which takes an argument and returns it as an array if it is already an array, or returns an array containing the argument value: // Here is the implementation of the toArray function: export const ...

Unable to retrieve device UUID using capacitor/device on Android

I'm currently attempting to obtain the UUID of my devices so that I can send targeted notifications via Firebase. My front end and back end are connected, enabling the back end to send notifications to the front end using Firebase. However, all I am a ...

The SortKey<> function is ineffective, even though the individual types it uses work perfectly fine

After my initial inquiry about TypeScript, the focus shifted to this current topic. In my previous question, I was attempting to develop a generic sort() method that could function with an array of sort keys defined by the SortKey type featured there (and ...