The AWS Cognito User Interface utilizes a hash in order to incorporate parameters during its invocation of the callback page

I'm encountering an issue with the AWS Cognito provided UI interface.

When attempting to use the provided UI, I make a call to the endpoint using the populated URL:

The issue arises after authentication when Cognito utilizes a # to return the required parameters. The returned result appears as follows:

http://localhost:3000/callback/#id_token=eyJragIsm2PqVpw&access_token=eyJraWQiOiJ&expires_in=3600&token_type=Bearer

I am struggling to extract and read the id_token and access_token on my callback page (which is a vue app).

Is there a way to configure Cognito to use the traditional question mark (?) for passing query strings, or how can I retrieve the passed parameters following the hash (#).

Your guidance on this matter would be greatly appreciated.

Answer №1

If you are utilizing the Vue.js router, handling the hash part can be easily accomplished. Simply insert this code snippet into your component. reference: https://router.vuejs.org/api/#the-route-object

let awsData = {}
if (this.$route.hash !== "") {
    let elementsString = decodeURIComponent(
        this.$route.hash.substr(1, this.$route.hash.length)
    );
    let params = elementsString.split("&");
    for (let param of params) {
        let values = param.split("=");
        awsData[values[0]] = values[1];
    }
}

// perform necessary tasks with awsData

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

Vue.js parent component not receiving data emitted by child component

Below you will find the child and parent components. I am struggling to pass data from the child component to the parent component. Can you help me pinpoint where the issue may be? Child Component <template> <div> <v-btn class="r ...

Delivering VueJS Builds via Express.js by leveraging history mode

I am trying to find a way to serve vue js dist/ through express js while using the history router in my vue js app. Here are some of the API calls I need: api/ s-file/sending/:id terms/get/:which I came across a Python solution on Github, but I'm ...

Is your list rendering in Vue.js with AJAX ready to go?

At this moment, my Vue.js component is retrieving data from an Elasticsearch query and displaying it in a list like this: <li v-for="country in countries">{{ country.key }}</li> The issue I am facing is that I want to show users only a snippe ...

Encountered an issue while attempting to decode the downloaded font. Parsing error from OTS in Vue

I'm facing an issue with importing a web-font into a specific component in my Vue App (built using the Vue cli webpack template). In one of my components, I attempted to import the fonts by referencing a _fonts.scss file within the project that looks ...

Integrating social login using vue-authenticate with passport in a Node.js environment

I've been working on integrating Facebook login with vue-authenticate and passport. Successfully logged into my Facebook account, I obtained the 'Callback code' as well. Here is my callback URL: http://localhost:8080/auth/callback?code=AQD0 ...

Avoid transitioning to a different page using Vue-router

I have recently ventured into the world of Vue.js and my current project involves fetching data from an API, implementing pagination, and creating a detailed view for each post upon clicking. I have successfully implemented the pagination feature, however, ...

CSS mismatch detected between production and development modes

Currently, I am utilizing the Vuetify framework coupled with custom CSS for a project developed using a webpack template. During development mode, my custom CSS modifications are successfully applied to HTML elements; however, in Production mode, these cha ...

After refreshing the page, vuex is encountering null values when using firebase.auth().onAuthStateChanged

Encountering an issue with Vuex and Firebase Authentication integration. When reloading the page, there is a delay in response from firebase.auth().onAuthStateChanged. I require an immediate response upon page reload without using router guards as seen in ...

Symbol positioned above the v-switch vuetify button

Currently utilizing Vuetify, I am trying to incorporate an icon on top of the button of a v-switch element. Despite searching through slots, I have not found a solution. <v-switch label="Dark mode" flat inset></v-switch> I am aimi ...

Issues with object changes not reflecting in Vue.js 2.0 component rendering

I am facing an issue where my object is not updating immediately after a click event. It appears that a manual refresh or clicking on another element is necessary for the changes to take effect. How can I ensure that the object updates without the need for ...

Unable to call Ionic component function using ref in Vue3

I'm attempting to utilize the closeSlidingItems method of the IonList element in order to automatically close the sliding item after clicking a button that appears from behind once the item is slid to the right. My approach involved referencing IonLi ...

What methods are there to verify computed properties in VueJS?

I'm currently working with VueJS through Vue CLI, which means all my components are in the .vue format. Within one of my components, I have an array named fields located in the data section. //Component.vue data() { return { fields : [{"name" ...

Why does Vue continuously insert undefined values when adding non-consecutive indexes to an array?

In my application, users can select values from a dropdown list and add them to an array by clicking the "add" button. The goal is to use the selected value's id as the index in the array. For example: List of Values 1 - Apple 3 - Bananas 8 - P ...

Changing an array with VueJS

I have encountered a strange issue while using vuex to store state. It appears that there is a problem with changing the id of one of my objects. During my action, I am fetching data about a specific note saveNote({commit}, noteInfo) { var for ...

Is there a way to retrieve JSON data using Vue and Axios?

I'm facing an issue trying to retrieve product data from a JSON file. Despite attempting different methods and searching for solutions online, I have not been able to find one that fits my specific scenario. As I am new to both Vue and axios, I apprec ...

What is the correct way to handle Vue props that include a dash in their name?

I am currently working on a project using Vue. Following the guidelines of eslint, I am restricted from naming props in camel case. If I try to do so, it triggers a warning saying Attribute ':clientId' must be hyphenated. eslint vue/attribute-hyp ...

Two items possess an identical worth

Whenever I make edits, both objects end up being the same. What is the solution to keep them separate? I have an object that I bind to inputs using v-model in order to update it. However, when I edit it without saving changes, the original object gets mo ...

Incorporating AWS-Cognito into Angular 2

I'm currently diving into the world of building web applications using Angular and AWS. My initial focus is on setting up authentication with AWS-Cognito. However, I've encountered some hurdles while trying to import and utilize the AWS-Cognito S ...

How can you extract path information from an SVG file and utilize it as a marker on Google Maps?

I want to implement a custom SVG icon as a marker on Google Maps. I have obtained this SVG file: <svg xmlns="http://www.w3.org/2000/svg" width="510px" height="510px" viewBox="0 0 510 510"> <g stroke="black" stroke-width="10" ...

What could be causing the slow build time for npm run serve on a Vue.js project?

My Vue.js project was running smoothly until about an hour ago when I noticed that it is now taking a very long time to build. Specifically, it gets stuck at 32% for more than 5 minutes. Does anyone have any suggestions on how to fix this issue? I'm n ...