adal.js

Angular5 HttpInterceptor depending on the result of an Observable

岁酱吖の 提交于 2019-12-03 20:56:17
问题 I am trying to implement using Angular5 an HttpInterceptor to inject an Authorization header in all HTTP requests. I rely on a third party library (ADAL, here called AuthService ) that exposes a acquireToken() method to get the token to be used for Bearer authorization. The problem is that aquireToken() returns an observable, and i have to subscribe to get the real string I need. Therefore, my code never injects the header, i suppose because next.handle() is executed before acquireToken()

Adal.js does not get tokens for external api endpoint resource

安稳与你 提交于 2019-12-03 18:49:44
问题 I'm trying out adal.js with an Angular SPA (Single Page Application) web site that gets data from an external Web API site (different domain). Authentication against the SPA was easy with adal.js, but getting it to communicate with the API is not working at all when bearer tokens are required. I have used https://github.com/AzureAD/azure-activedirectory-library-for-js as template in addition to countless blogs. The problem is that when I set up endpoints while initiating adal.js, adal.js

How do I make 'forgot password' working in react-aad-msal with Azure AD B2C?

笑着哭i 提交于 2019-12-01 22:03:57
I am using react-aad-msal with Azure AD B2C. I have sign-in and sign-out working. However, when I click 'Forgot your password?', the auth window disappears and nothing happens. It seems I need to specify name of my 'forgot password' policy, but I do not know where to put it. Based on Tony's answer added this code to my App's render: if (window.location.href.indexOf("error_description=AADB2C90118") >= 0) { return <AzureAD provider={ new MsalAuthProviderFactory({ authority: 'https://login.microsoftonline.com/tfp/x5aaas.onmicrosoft.com/B2C_1_PwdReset', clientID: 'a1568977-3095-4bf6-a6d6

How do I make 'forgot password' working in react-aad-msal with Azure AD B2C?

血红的双手。 提交于 2019-12-01 18:57:50
问题 I am using react-aad-msal with Azure AD B2C. I have sign-in and sign-out working. However, when I click 'Forgot your password?', the auth window disappears and nothing happens. It seems I need to specify name of my 'forgot password' policy, but I do not know where to put it. Based on Tony's answer added this code to my App's render: if (window.location.href.indexOf("error_description=AADB2C90118") >= 0) { return <AzureAD provider={ new MsalAuthProviderFactory({ authority: 'https://login

Angular HTTP Interceptor how to chain an observable

强颜欢笑 提交于 2019-12-01 08:49:10
I am using the Azure AD adal library to do authentication. There is a call to aquire a token that returns an observable. How can this observable be added into the intercept? In the below example, how can I get the request that is set inside the subscribe to be returned as the Observable? intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { this.authAzureService.getAccessToken() .subscribe(token => { // I need this to be returned request = this.getRequestWithHeaders(request, token); }); // This returns the request before the access token is added return next

Angular5 HttpInterceptor depending on the result of an Observable

断了今生、忘了曾经 提交于 2019-11-30 22:44:56
I am trying to implement using Angular5 an HttpInterceptor to inject an Authorization header in all HTTP requests. I rely on a third party library (ADAL, here called AuthService ) that exposes a acquireToken() method to get the token to be used for Bearer authorization. The problem is that aquireToken() returns an observable, and i have to subscribe to get the real string I need. Therefore, my code never injects the header, i suppose because next.handle() is executed before acquireToken() returns any value. How can i ensure that the next handler is called only after the token has been

MVC AD Azure Refresh Token via ADAL JavaScript Ajax and KnockoutJs

你。 提交于 2019-11-30 20:22:36
There is an inherent design flaw in the type of MVC application I have built and I believe I'm not the first to realize. I have an MVC 4 Application that utilises AD Azure Authentication that was introduced to the application in the following way Developing ASP.NET Apps with Azure Active Directory Once as User is Authenticated and Home.cshtml loads, KnockoutJs is used to perform JavaScript AJAX POST and GET requests to read and write data. So not exactly a Single Page App, but rather, a mix of traditional postbacks for Authentication and Serving Assets and Read/Write operations through AJAX.

MVC AD Azure Refresh Token via ADAL JavaScript Ajax and KnockoutJs

我的梦境 提交于 2019-11-30 04:58:01
问题 There is an inherent design flaw in the type of MVC application I have built and I believe I'm not the first to realize. I have an MVC 4 Application that utilises AD Azure Authentication that was introduced to the application in the following way Developing ASP.NET Apps with Azure Active Directory Once as User is Authenticated and Home.cshtml loads, KnockoutJs is used to perform JavaScript AJAX POST and GET requests to read and write data. So not exactly a Single Page App, but rather, a mix

Adal.js does not get tokens for external api endpoint resource

六眼飞鱼酱① 提交于 2019-11-30 01:57:34
I'm trying out adal.js with an Angular SPA (Single Page Application) web site that gets data from an external Web API site (different domain). Authentication against the SPA was easy with adal.js, but getting it to communicate with the API is not working at all when bearer tokens are required. I have used https://github.com/AzureAD/azure-activedirectory-library-for-js as template in addition to countless blogs. The problem is that when I set up endpoints while initiating adal.js, adal.js seems to redirect all outgoing endpoint traffic to microsofts login service. Observations: Adal.js session

How to integrate azure ad into a react web app that consumes a REST API in azure too

时光总嘲笑我的痴心妄想 提交于 2019-11-28 07:39:54
I have one web app which is React, and I already configured Azure AD Authentication for the web app itself. Its 100% Client site app, no server side components. I used this component: https://github.com/salvoravida/react-adal My code is as follows: adalconfig.js import { AuthenticationContext, adalFetch, withAdalLogin } from 'react-adal'; export const adalConfig = { tenant: 'mytenantguid', clientId: 'myappguid', endpoints: { api: '14d71d65-f596-4eae-be30-27f079bf8d4b', }, cacheLocation: 'localStorage', }; export const authContext = new AuthenticationContext(adalConfig); export const