Google API redirect_uri_mismatch error encountered during c# asp.net login authentication

On my ASP.NET page, I am attempting to implement Google login using my clientID and a specified redirect_uri in the Google Console. However, when I try to log in, I encounter the following error.

Error: 400. That’s an error.
Error: redirect_uri_mismatch
Application: odiyaDoctor
You can email the developer of this application at: [email protected]
The redirect URI in the request: http://localhost/immediateHelp.aspx did not match a registered redirect URI.

This functionality requires users to log in through Google on the first page (UserLogin.aspx) and then be redirected to the next page (i.e.immediateHelp.aspx) upon successful login. Below, I provide all relevant code and Google credentials.

UserLogin.aspx:

<a href="#" class="btn btn-large btn-block btn-google" onclick="googleLogin();"  >Login with Google <i class="fa fa-google-plus"></i></a>
<script>
    // Relevant JavaScript code
</script>

On the UserLogin.aspx page, I encountering the following error within the catch section:

at http://localhost:3440/UserLogin.aspx:92:32 UserLogin.aspx:103 its error DOMException: Blocked a frame with origin "http://localhost:3440" from accessing a cross-origin frame. at Error (native)

clientID set in google.

Client ID for web application

Client ID   
***************************************1ctsjaeg96b1elfa8.apps.googleusercontent.com
Client secret   
*********oGbT13hv3S
Redirect URIs   
https://localhost/immediateHelp.aspx
JavaScript origins  
https://localhost

I aim for seamless redirection to the immediateHelp.aspx page upon successful user login, followed by an option for logout on that page. Any assistance in resolving these issues would be greatly appreciated.

Answer №1

`Are you aware that "http://localhost/immediateHelp.aspx" is not the same as "https://localhost/immediateHelp.aspx"? Make sure the URL is exact.

It's essential for the URL to be precise down to every character.

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

Checking dates in a JavaScript form

var myForm = document.getElementById("form"); document.bgColor="#FFFFCC"; //page styling myForm.style.color="blue"; myForm.style.fontSize="20px"; myForm.style.fontWeight="400"; myForm.style.fontFamily="arial"; function validateForm() { var firstname = d ...

Troubleshooting: Angular 2 View not reflecting changes after array push

I have encountered an issue with my two child components. They are both meant to share data from a json file that I load using the http.get/subscribe method. Oddly enough, when I try to push new data into the array, it doesn't seem to update in the vi ...

Node.js is known for its ability to export both reference and pointer values

Having an issue with exporting my routing table from my express application. In the /bin/www.js file, there is a global variable representing the routing table: var routingTable = []; To create a simple route, new routing objects are pushed using the se ...

typescript: the modules with relational paths could not be located

As part of a migration process, I am currently converting code from JavaScript to TypeScript. In one of my files 'abc.ts', I need to import the 'xyz.css' file, which is located in the same directory. However, when I try to import it usi ...

What is the best way to change CSS style for a button when clicked using JavaScript?

Is there a way to switch the background style of a CSS div when clicking the same button? function changeBg() { var divElem = document.getElementById("change-bg"); if (divElem.style.backgroundColor === "yellow") { divElem.style.backgroundColor ...

How can you dynamically change visibility in AngularJS depending on the text within the element?

Consider the following HTML snippet: <p id="message" ng-show="something"></p> As the page loads, the #message element may be populated with text from an AJAX request. I want to show or hide #message based on whether it has content or not. S ...

Encountering a syntax error close to an unexpected token '../lib/cli.js' while attempting to launch an application through pm2 start

I'm encountering an issue while executing pm2 start with an ecosystem.config.js /root/.nvm/versions/node/v18.16.0/bin/npm: line 2: require('../lib/cli.js')(process)' /root/.nvm/versions/node/v18.16.0/bin/npm: line 2: syntax error near u ...

What is the process for setting up URL parameters in Express JS?

I am working on creating an URL that can accept a query after the "?" operator. The desired format for the URL is "/search?q=". I am wondering how I can achieve this in Express JS, and also how I can integrate the "&" operator into it. ...

Using TypeScript with Watermelondb

I'm currently developing a React App and I want to implement Watermelondb for Offline Storage, but I'm unsure about using it with TypeScript. I have already set up the database and created Course and Lesson model files from the Watermelondb libra ...

Having trouble submitting ajax form data through nodemailer

Hey there, Recently, I created a web app using node.js and express. Everything seems to be working fine except for one issue - I am struggling to get the JSON data sent by AJAX into Nodemailer. Despite confirming that my AJAX is successfully sending the ...

Using jQuery, make sure to only select a single checkbox within the gridview

In my grid view, I have set up checkboxes in the ItemTemplate. The goal is to select only one checkbox from the GridView to identify the specific row and use its ID for editing or deleting purposes. Below is a snippet of the ASPX page code: <asp: ...

Issue with Bootstrap 3 Modal: Missing Title and Input Labels

I'm currently working on customizing a bootstrap template for my friend's church website. My goal is to create a simple web presence for them, and I am in the process of setting up a contact form. I want this form to appear as a modal where users ...

In a JavaScript array of objects, the Vuetify select :items feature allows you to assign an id and name to each object. When a name is selected, the corresponding id is automatically

I am currently working with an array of objects that contain both an id and a name property: Teams [ { id: 1, name: 'team1' }, { id:2, name: 'team2' } ] Is there a way to dynamically pass the names as items in a vuetify selec ...

Eliminating the need for double clicking

Check out my JSFiddle demo. I have implemented a basic event handler for the 'click' function: $('#traveller > a').click(function(e) { e.preventDefault(); var $ul = $('#traveller ul'); if($(this).hasClass(&apo ...

Removing SESSION variables upon closing a tab

Currently, I am facing a challenge in finding a suitable solution to clear session variables when the tab is closed. Even after exploring various options, the closest method I found involves using the "onbeforeunload" function in JavaScript. <body onbe ...

Sending Input from Text Boxes Inside a Repeater

Looking to implement a straightforward feature, I have added a text box in a repeater item to allow users to add notes. However, the code I have written does not seem to be working as expected. Sample ASPX Code: <asp:Repeater ID="rptL ...

Ways to remove the console of the 404 error triggered by a fetch request

I have a task where I need to verify the existence of a URL by fetching it, and then handling any errors in the console. useEffect(()=>{ for(let item of data){ fetch(`variable data by item`) .then((res) => res.status) .then(re ...

Guide on utilizing index.html, incorporating ui.router, and effectively redirecting back to the homepage

When testing my Angular app, I am using a Python simpleserver. I am new to ui.router and I am trying to get my index.html file to work properly. When attempting to navigate back home, I use the following code: <a class="navbar-brand" ui-sref="/">My ...

I am unable to halt the relentless stream of asynchronous events

Struggling to retrieve an array using a loop in the asynchronous environment of nodejs. Check out my code below: getDevices(userIDs, function(result) { if (result) { sendNotification(messageUser, messageText, result); res.send("Success"); } else { ...

What is the proper file format for a form action in CSS?

What I Currently Have: In my Index.html file, there are a total of 4 form elements including text fields and a dropdown. Upon submission by the user, the data is processed in confirm.html using a separate JavaScript file for formatting before being displa ...