Error occurred during MS ADAL Integration: Authentication failed due to user canceling the flow on Ionic 4 with RequestId

Currently, I am attempting to incorporate Ms ADAL into my Ionic 4 project, but encountering the following issue:

Authentication failed Error: User cancelled the flow RequestId

Below is a snippet of my code:

import { MSAdal, AuthenticationContext, AuthenticationResult } from '@ionic-native/ms-adal/ngx';

constructor(
private msAdal: MSAdal
  ) {}

  let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');
      authContext.acquireTokenAsync('https://graph.windows.net', 'MY-ID-CLIENT', 'http://localhost:8000/','','')
      .then((authResponse: AuthenticationResult) => {
        console.log('Token is' , authResponse.accessToken);
        console.log('Token will expire on', authResponse.expiresOn);
      })
      .catch((e: any) => console.log('Authentication failed', e));

https://i.sstatic.net/j6jDu.png

If anyone can offer assistance, it would be greatly appreciated. Thank you!

Answer №1

The solution to the problem lies in adding graph.windows.net and rebuilding the app.

For more information, please refer to the following resources: Link Link2

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

Handling click events on Datatable.net paging buttons

My goal is to capture the click event when one of the paging buttons on the Datatable is clicked in Angular. I'm not exactly sure how to go about accomplishing this! If I refer to this example, how can I adapt the code for Angular? Specifically, how ...

How can I position ports on the right side of a graph element in JointJS?

I'm in the process of developing an Angular application that allows users to dynamically create graphs. Currently, I am working on a function that adds ports to vertices and I want the user to be able to select the position of the port (right, left, t ...

Angular universal triggers an "Error at XMLHttpRequest.send" issue

After updating my project to Angular 10 and incorporating angular universal, I encountered a strange error. While the application builds without any issues, I face an error when trying to run it on my development environment: ERROR Error at XMLHttpReque ...

Despite the classes showing up on the HTML tag, the Tailwind CSS is failing to function correctly

Something seems off with my tailwind setup - it never seems to work on the first try. This screenshot clearly shows that the html tag is changing I've made changes to my global.css configuration like this: @import "tailwindcss/base"; @impo ...

Despite the unconsumedBufferLength being 0, DataReader.loadAsync is still being completed

Working on UWP WinRT, I'm dealing with JSON stream consumption using the following code: async function connect() { let stream: MSStream; return new CancellableContext<void>( async (context) => { stream ...

Vue3 with Typescript encounters an issue when attempting to apply v-model to a textarea element

Trying to implement v-model on a tag within my Vue component, I encountered the following error that is puzzling me: The 'textInput' property does not exist on the type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> ...

What is the method for accessing the constructor type of an interface?

I am familiar with accessing a property type of an interface using interfaceName['propertyName'], but how can we access the constructor? For example: interface PromiseConstructor { new <T>(executor: (resolve: (value?: T | PromiseLike& ...

Struggling to choose an option from the autocomplete feature with protractor

<select name="Name" class="metaselect ignore" style="display: none;" xpath="1"> <option value="00000000-0000-0000-0000-000000000000" selected="selected">-- New --</option> <option value="bd434f35-90db-e911-aa59-a96c125b4266">Ad ...

Error encountered when extending Typography variant in TypeScript with Material UI v5: "No overload matches this call"

Currently, I am in the process of setting up a base for an application using Material UI v5 and TypeScript. My goal is to enhance the Material UI theme by adding some custom properties alongside the default ones already available. The configuration in my ...

Using React with Keycloak - Can only be initialized once

After encountering issues in my main application, I decided to create a new raw react project and follow the documentation to implement a simple keycloak login. The guide I used can be found here: https://github.com/react-keycloak/react-keycloak/blob/maste ...

Choosing an element that does not have a particular string in its colon attribute name

In my code, I have multiple elements structured like this: <g transform="matrix"> <image xlink:href="data:image/png" width="48"> </g> <g transform="matrix"> <image xlink:href="specific" width="48"> </g> <g tran ...

Access exclusive content by subscribing now!

How can I return a reference to a subject from a service without allowing the receiver to call .next() on the subject? Let's say there is a service with a subject that triggers new events. class ExampleService { private exampleSubject = new Subjec ...

How come the path alias I defined is not being recognized?

Summary: I am encountering error TS2307 while trying to import a file using an alias path configured in tsconfig.json, despite believing the path is correct. The structure of directories in my Angular/nx/TypeScript project appears as follows: project |- ...

Beneath the Surface: Exploring Visual Studio with NPM and Typescript

Can you explain how Visual Studio (2015) interacts with external tools such as NPM and the Typescript compiler (tsc.exe)? I imagine that during the building of a solution or project, MSBuild is prompted to execute these additional tools. I'm curious a ...

Analyze the information presented in an HTML table and determine the correct response in a Q&A quiz application

I need to compare each row with a specific row and highlight the border accordingly: <table *ngFor="let Question from Questions| paginate: { itemsPerPage: 1, currentPage: p }"> <tr><td>emp.question</td></tr> <tr> ...

Comparing SomeType to SomeType[] - Which One Is Better?

Using a constant string value to narrow down a union type is simple and effective: type Payload1 = { /* ... arbitrary type ... */ }; type Payload2 = { /* ... arbitrary type ... */ }; type T1 = { type: 'type1', payload: Payload1 } type T2 = { type ...

Attempting to display two separate d3 line graphs within a single Ionic2 page

I am facing an issue with including multiple similar graphs on a single page within an Ionic2 application. I am utilizing the d3-ng2-service to wrap the d3 types for Angular2. The problem arises when attempting to place two graphs in separate div elements ...

Is there a way to consolidate two interface types while combining the overlapping properties into a union type?

Is there a way to create a type alias, Combine<A, B>, that can merge properties of any two interfaces, A and B, by combining their property types using union? Let's consider the following two interfaces as an example: interface Interface1 { t ...

The interaction between Nextjs router and useEffect resulting in unintended re-rendering

I'm currently facing a challenge with Next.js's next/navigation router. In my component, I have a series of useEffects implemented. Strangely, when I call router.replace, one of the effects runs twice or even infinitely in some cases. As a result ...

Executing a function within the same file is referred to as intra-file testing

I have two functions where one calls the other and the other returns a value, but I am struggling to get the test to work effectively. When using expect(x).toHaveBeenCalledWith(someParams);, it requires a spy to be used. However, I am unsure of how to spy ...