Using AngularJS to fetch Google OAuth2 tokens

Every time I initiate this call, it triggers the account selector to open. Following which I can choose one of my Google accounts, but upon selection, an error occurs.

Error: invalid_request

Missing required parameter: scope

The URL in the account selector shows the presence of the scope variable, yet it somehow gets lost when the account is selected. Please note that I have altered my client ID in this particular example. Appreciate any assistance provided.

 app.controller("FirstController", function($scope, $location) {
$scope.redirectToGoogle = function () {
    console.log("redirectToGoogle");
    var client_id="myclientID";
    var scope="profile email";
    var redirect_uri="http://localhost:8080/auth/google/callback/";
    var response_type="token";
    var url="https://accounts.google.com/o/oauth2/auth?&client_id="+client_id+"scope="+scope+"&redirect_uri="+redirect_uri+"&response_type="+response_type;
    window.location.replace(url);
}

});

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

Deduce the generic types of conditional return based on object property

My goal is to determine the generic type of Model for each property. Currently, everything is displaying as unknown[] instead of the desired types outlined in the comments below. playground class Model<T> { x?: T } type ArgumentType<T> = T ...

I am encountering some difficulties with the functionality of the angularjs dialog

I've been attempting to integrate an AngularJS dialog feature into my application by following the examples provided on material.angularjs.org. However, despite copying everything accurately, I am unable to get it to function. Can anyone help identify ...

Success function in AJAX triggered when no JSON data is returned

Despite its simplicity, I'm having trouble getting this right. I'm utilizing jQuery/AJAX to fetch data (in the form of JSON) from my database. Upon successful retrieval, I have a function to display the data. While this works as expected, I now a ...

Retrieving elements from another component's scope

Struggling with displaying a D3.js graph defined in one Angularjs 1.5 component on a page that relies on a different one. I'm still learning Angular, and although I believe the solution lies within the official documentation's example of a compon ...

Setting the display tag in the select dropdown when using ng-options

Check out this code snippet: <select ng-model="something" ng-options="availThing.description for availThing in availableThings > <option value="">-- please choose an option --</option> </select> I have a question regarding t ...

Vue.js versatile form for both adding and editing

As a newcomer to the world of vue.js, I am currently working on expanding some tutorials that I have completed. After struggling with this for three hours now, I must admit that I am feeling quite frustrated. Just to give you a heads up, I am using firebas ...

React.js error: Uncaught TypeError: Cannot read property 'map' of null

Hey there, I'm currently working on creating a MERN Stack web app following this tutorial: https://youtu.be/aibtHnbeuio. I'm fairly new to the stack and could really use some help fixing this issue... Error Encountered: TypeError: Cannot read p ...

Ways to access file attributes and transfer a file in ionic 4?

I am facing an issue while attempting to transfer a file from my mobile device to Google bucket using Ionic 4. Although I can successfully upload the file, I am struggling to extract its properties from the file object. Below is the method I am using: as ...

What is the best way to retrieve a value from an `<input type="number">` element and incorporate it into the script section?

Check out this code snippet <html> <head> head <title>title</title> </head> <script> var val1 = parseInt(document.getElementById('input1')); function bytton() { window.alert(val1); ...

timer-based user session expiration

Currently, the app I'm developing has a system where a session is created with a 15-minute expiration time once a user interacts with a form. This session is managed server-side. If the user remains idle for 15 minutes, the server returns a 404 erro ...

Image that floats or pops over the content

I'm currently working on designing a card similar to the one displayed in the image. However, I'm facing difficulty in creating the floating image effect on the card. Any tips or suggestions on how to achieve this using angular, jquery, css, or a ...

Creating a nested list using v-for and Vue components

Currently, my goal is to display nested lists using Vue components. I have developed two components for this purpose: one component to showcase the 'Blog' posts and another component to showcase the comments. While the 'Blogs' are appea ...

Creating a Javascript map that holds an array of strings as values, mirroring the functionality found in Java

Seeking guidance on implementing HashMap functionality in JavaScript. Discovered the map() global object introduced in ES6 for this purpose. However, encountering issues when attempting to set a value as an array. Any help would be appreciated. Map-JavaS ...

Encountering a syntax error when trying to parse a local storage object?

I've been exploring ways to store random numbers generated by Math.random. I've come up with a solution where I save the numbers in an array, which is then stored in localStorage. My goal is to append each new array of numbers whenever Math.rando ...

Generate a new entry and its linked data simultaneously

The Issue: Picture this scenario: I have two connected models, Library which has multiple Books: var Library = sequelize.define('Library', { title: Sequelize.STRING, description: Sequelize.TEXT, address: Sequelize.STRING }); var Boo ...

Working with NodeJS: Utilizing object casting with default values and eliminating superfluous

In the backend code of a NodeJS application, there is an object defined as follows: { name : "foo" secret : "bar" } The objective is to return this object as JSON in response to an HTTP request without including the secret key. The desired return obj ...

What are the steps to create a dynamic navigation bar in React without encountering hydration issues?

My goal is to dynamically show or hide links based on user authorization. Here's my initial approach: const Navbar = () => { const { canDo, ...} = useUser(); //A Zustand store return ( <> <div> <ul> ...

Tips for resizing a 100% div without displaying vertical scrollbars in the browser

I am facing an issue with a table that has three rows. I have a main #container div with a height of 100%, and inside it is a table with 3 rows. The first and last row contain fixed size content. However, in the second row, there is a #content div with a h ...

When attempting to execute a function within another function in JavaScript, a ReferenceError is triggered

I recently developed a straightforward app that utilizes the Google Drawing Library (https://developers.google.com/maps/documentation/javascript/examples/drawing-tools) to allow users to draw circles on a map. The first circle represents the source locatio ...

Reset AngularJs service data

My goal is to save information in my services similarly to the solution found in : Processing $http response in service app.factory('myService', function($http) { var promise; var myService = { async: function() { if ( !promise ) ...