The Complete Guide to Angular User Authentication with Auth0

Learn how to add user authentication to Angular using Observables and HTTP Interceptors.
Read more…

Brought for you by @dan-auth0

What are you thoughts guys? Share it in the comments!

Excellent post; well laid out; easy to follow; detailed where needed to be.

I tripped up in only 1 place:
When configuring the .env file in the express sample API, added the AUTH0_ISSUER_URL, the URL much have a trailing forward slash [/]. If this is missing then the check-jwt constant creates malformed URL. This will result in a 60 second timeout to Auth0.

Error: connect ETIMEDOUT 92.242.132.24:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16) { errno: -60, code: 'ETIMEDOUT', syscall: 'connect', address: '92.242.132.24',

Missing forward slash :-1:
https://[tentan].auth0.com.well-known/jwks.json

With forward slash GOOD :+1:
https://[tentan].auth0.com/well-known/jwks.json

Hope this helps.

2 Likes

Thanks for sharing that with the rest of community!

2 Likes

Howdy, Dom! Thank you for reading the blog post and your feedback :slight_smile:

That’s correct, the entire issuer URL must be used as present in the code snippet from the “Quickstart > Node.js” codebox:

image

Without the trailing slash, it fails. Since this often trips people, I am going to add a note warning the reader to ensure the trailing slash is present. Thank you!

1 Like

i am getting this error WARNING in ./node_modules/@auth0/auth0-angular/fesm2015/auth0-auth0-angular.js 49:26-44 "export 'ɵɵdefineInjectable' was not found in '@angular/core'.Actually it is warning but it prevent my app to run…i am assuming this might be version issue.Can anyone please help?Below are other details…

   "@auth0/auth0-angular": "^1.2.0",

Angular CLI: 7.3.10
Node: 12.18.4
OS: win32 x64
Angular: 7.2.16```

Hello. Thank you for joining the Auth0 community. Can you try the options given in this StackOverflow question, please?

It seems the error you are getting is related to conflicting package versions.

I did try above stackoverflow question…it seems your auth0 Angular SDK works with Angular 10 and I am using angular 7.Do you have the SDK which is compatible with Angular 7?

1 Like

Let me check with the SDK dev team if there is a minimum required Angular version for the Auth0 Angular SDK :slight_smile:

I checked with the team and the README for the Auth0 Angular SDK states that:

A library for integrating Auth0 into an Angular 9+ application.

Sorry about that. I’ll update the blog post to highlight the supported versions.

For Angular versions below 9, you can use the Auth0 SPA SDK:

Please let us know if you have any questions implementing Auth0 in your Angular apps using the Angular SPA SDK in a new topic here:

https://community.auth0.com/c/general/6

We do encourage customers to update to Angular 9 or higher when possible as the long term support (LTS) for Angular 7 has ended and LTS for Angular 8 ends in Nov 28, 2020.