adal-angular4 | Angular 4/5/6/7 ADAL Wrapper | Build Tool library
kandi X-RAY | adal-angular4 Summary
kandi X-RAY | adal-angular4 Summary
Angular 4/5/6/7 ADAL Wrapper
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of adal-angular4
adal-angular4 Key Features
adal-angular4 Examples and Code Snippets
Community Discussions
Trending Discussions on adal-angular4
QUESTION
We have a site developed using Angular 7 and it uses Adal-Angular4 library for Azure Active Directoty authentication. When the site is browsed in safari on iPhone, it runs into below error.
...ANSWER
Answered 2020-Apr-30 at 17:51Reason: The error occurs because a silent sign in is sent to the login.microsoftonline.com endpoint, however the AAD SSO cookie is not being detected. This cookie determines if the user is logged in or not. The silent sign in is only meant to be used if the user is already known to be logged in or has a refresh token to exchange for a new access token.
Possible Resolution #1 Proactively Check for Expiration You can attempt to prevent this error from ever occurring by checking if you have a valid id token. If you're ID token is not valid, you will ask the user to login again.
Possible Resolution #2 Catching the Error and Asking the User to Login Again To resolve this error you will need to catch this error in a callback that you can pass into the acquiretoken ADAL JS function. If the AADSTS50058 error occurs, you'll ask the user to login again.
Possible Resolution #3 Browser Extension Cookie Blockers and Third Party Cookies Disabled Some users may experience this issue due to a browser extension that is blocking cookies for tracking purposes. This will cause this AADSTS50058 error to occur, you will need to whitelist the login.microsoftonline.com endpoint in your browser extension in order to avoid receiving this error again.
This error can also occur if the third party cookies have been disabled in your browser. Re-enable third party cookies in your browser to prevent this error from occurring.
Please refer this link
QUESTION
In case of the router below, is it possible to set an alternative route (like /
for instance) for when AdalGuard
disallows access to route /int
or to one of its children routes?
I knew I could do this inside the guard class, by calling .navigateByUrl()
inside of it or returning a UrlTree
. But in this case AdalGuard
comes from package 'adal-angular4', so I can't do such thing.
Is there something like an 'Else' or 'Catch' pointer to another route, that I could put inside the definition of the guarded route?
Thank you very much.
app-routing.module.ts
ANSWER
Answered 2020-Mar-31 at 18:05AdalGuard
itself is simple if you look at the source code.
You could either fork it or extend it. I would fork it so that you can retain full control over the functionality.
As far as I can tell userInfo.authenticated
always returns a synchronous boolean.
QUESTION
I have an angular 8 application under Visual Studio Professional 2017 Aspnet Core. If I run the application via angular cli with ng serve
(or npm start
) it works well, I can access the application. But if I try to start it with debug on Visual Studio with IIS, it never starts. Only error I got is {"error":"The Angular CLI process did not start listening for requests within the timeout period of XXX seconds. Check the log output for error information."}
I wrote XXX seconds because it is not about timeout, application never starts whatever timeout I set. I updated angular core packages to latest, updated Visual Studio 2017 to latest, deleted the dist folder, deleted node modules, basically tried everything I saw in the internet.
My core version is: 2.2.101
And I run Visual Studio as administrator.
Same code is working wonderfully in my colleague's PC.
Here is my Startup.cs
...ANSWER
Answered 2020-Feb-11 at 08:29The problem looks like a bug in how Visual studio handles the startup of the angular server in debug mode:
QUESTION
I am using following package to implement Azure AD auth in an Angular application:
https://www.npmjs.com/package/adal-angular4
After 10-20 minutes the token expires. There is another thread where the discuss something similar, but I simply cant find a valid solution. To be honest when reading the post I am not even sure if it is possible due to the nature of implicit flow. All pointers are welcome.
Angular 2 ADAL token refresh, for implicit flow (using "adal-angular4")
I have my authredirect page where Azure redirects to:
...ANSWER
Answered 2019-Sep-26 at 21:44You are in luck I have been through this exact same problem before and it took me weeks to resolve it. To acquire a access token and a refresh token you need to use Microsoft's MSAL library instead of ADAL. There is absolutely no way to refresh your token without using MSAL. Microsoft's MSAL library is useless though. I wrote a simplified version from scratch specifically for my Angular application. I uploaded it to github for you. MsalService.ts. Hopefully you can make use of it.
Basically whenever you need an authentication token use the msalService.acquireToken
function. If no token is returned from that function the user should be logged out. Use msalService.login
and msalService.logout
to well, log the user in or out.
Due to CORS limitations you cannot request an access token or refresh token from the client side of your application. I created endpoints on my server to make the requests.
QUESTION
I have built a simple angular app and for authentication, I authenticate against AzureAD using use the npm package adal-angular4
When authentication happens, the user gets sent to https://login.microsoftonline.com
they login and get sent back to the agulare app which causes a reload/recompile which will cause a load time delay, only short but the overall load time experience is doubled.
As you can see above :
- login is loaded (localhost)
- app is compiled
- user taken to login screen (azuread)
- user logs in and user is taken back to login (localhost)
- app is complied
The load gap between main.bundle.js
and background'
is a simple way to show the compile time, its only a VERY TIME but I have a VERY FAST PC.
What can be done to avoid the recompile? My thoughts are
- Do all the auth in the index.html (eg, pre first load of APP) and just save the JWT token to the session storage
- Find an angular packages do this via an IFRAME
Anyone got any thoughts on this? maybe adal-angular4
should use an IFRAME?
Some more details
Example of adal-angular4
Microsofts anglurejs example which uses this javascrit maybe this is a good starting place for a pure JavaScript solutoon thats executed from the index.html.
...ANSWER
Answered 2017-Jul-03 at 07:01Based on my understanding, this is not able to avoid. When the app interact with Azure AD via the Oauth protocol, the flow is like below:
- users click start login-in progress from app
- the app was redirected to the identity data provider(Azure AD)
- users enter the username/password
- the identity data provider response with the 302 redirection to the app
Do all the auth in the index.html (eg, pre first load of APP) and just save the JWT token to the session storage
No, as see the progress in the steps above the authentication has two steps. First is authentication with Azure AD, then the web app authenticate the users with the id_token issued by Azure AD.
More detail about the Oauth 2.0, you can refer the link below:
QUESTION
I have a SPA (angular 7) and an API (.Net Core) which I authenticate with Azure AD. I'm using adal-angular4 to integrate my angular application with AAD.
Everything works great, but I'm also using SignalR with the API as server and when I try to connect from my SPA I get 401 Unauthorized on the negotiate "request" and I get this back in the Response Headers:
The request contains my Bearer token in the Authorization header, and when I run the token through jwt.io, I can see that the "aud" value is the Azure AD ClientId for my SPA.
All regular request to the API contains the same token and I have no issues with those. I have [Authorize] on all my Controllers and on my Hub, but it's only the SignalR Hub that causes this issue.
My server Startup:
...ANSWER
Answered 2019-Sep-02 at 07:37When validating the signature of access token , you should get the public key since Azure AD may sign token using any one of a certain set of public-private key pairs , the keys could be found at :
QUESTION
On Windows, angular 6: I tried use many port but no any port work. I always receive error message: Port xxx is already in use. Use '--port' to specify a different port.
I also researched and tried many ways: - turn of firewall - using netstat to view ports and no any process use them - change other version of angular-cli, typescript in package.json But no solution for this.
This is my package.json file:
...ANSWER
Answered 2019-Aug-20 at 15:50I have fixed this issue. This is my solution:
- Remove node_modules, include package-lock.json
Run npm i, then I faced this error:
ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error > TS2420: Class 'NgRedux' incorrectly implements interface 'ObservableStore'. Property '[Symbol.observable]' is missing in type 'NgRedux'.
I reinstall redux@4.0.1 by command: npm i redux@4.0.1
- After finish, I start ng serve. It works OK.
Thanks for your attention.
QUESTION
I am building an application using angular and spring boot. I need to use Azure AD for SSO from frontend then secure the spring boot services using the token. (In short my angular will connect with office 365 to login and then the user will authenticate connect with spring security, where it will verify the token, if valid it will give a response.) In angular, I am using adal-angular4 and in spring boot azure-active-directory-spring-boot-starter. Also, how to register the application(Frontend and backend) in Azure AD portal.
I am tried using some article. I get the response from the postman when I hit the URL using the token.
...ANSWER
Answered 2019-Jun-19 at 19:41iamelix, I had the same problem. My issue was that my auth URL and token URL did not include the resource parameter.
The format of the Azure auth URL and token URL are below.
Postman Azure AD
Auth URL format: https://login.microsoftonline.com/[tenant_id]/oauth2/authorize?resource=[application_id]
Access Token URL format: https://login.microsoftonline.com/[tenant_id]/oauth2/token?resource=[application_id]
The key for me was adding the resource parameter to the auth URL and token URL, and now my requested token includes the valid audience so it is accepted by Azure AD with no errors. I found the above information from this very helpful article: https://www.bruttin.com/2017/11/21/azure-api-postman.html
QUESTION
I'm using adal-angular4 on the frontend to login and that works, it's successful and through the process it doesn't ask me if I want to use my business account or my personal account and afaik there's no 'persona' account with the email I'm trying to login.
The app itself is configured to allow only B2B and I have the endpoint configured as 'common';
Now, I am sending that token to the backend where I have passport-azure-ad and again I have configured everything as B2B and I have tried both common endpoints. Everytime, the shape of the token does not have the properties listed by the types provided in @types;
And in the token details I can see: idp: 'live.com'
which makes it seem like I have logged in with my personal account actually?
I've also tried with a different B account and it seems that the shape of the token is correct and has no 'idp: 'live.com'
property.
So it seems to me:
- The app in the FE shouldn't let me login with a personal account(???)
- The login screen should still let me choose between personal/business account
- Passport plugin shouldn't return 'token verified' if its a personal account? whilst I configured it to be b2b everywhere?
How can I enforce B2B accounts? Screenshot of my config in the azure portal.
...ANSWER
Answered 2019-Jun-04 at 14:18You can set msafed=0
on the query when redirecting to authenticate. That disables personal accounts on v1.
A user could remove the parameter so you may want to check the token after login.
QUESTION
I've got a web app written in Angular 6 using the adal-angular4 package to perform authentication via AAD. I am trying to get the UI to communicate with a backend service using this token. However, I keep getting a 401 Unauthorized response when trying to call the server's APIs even when all of the validation should be turned off. Inspecting the token with jwt.io yields an "invalid signature" error at the bottom of the page, but otherwise the token is readable.
As for AAD configuration, both the frontend app and backend service are registered as separate AAD apps, so any references to clientId
or clientAppId
refer to the client's application id while apiServiceId
refers to that of the backend service. I have also exposed a scope in the backend app registration, added an API permission to the frontend app registration for that scope, and authorized the frontend app in the backend app. I have also enabled implicit grant for both id tokens and access tokens for both services. Here's the relevant code:
app.module.ts:
...ANSWER
Answered 2019-Jan-17 at 22:18So it turns out I was setting up the middleware in the incorrect order in startup. See this answer, where the asker had to register AAD authentication earlier in the pipeline in order to get things working. Otherwise you may just get 401 responses every time regardless of configuration.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install adal-angular4
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page