#Angular with Auth0 integration
27 messages · Page 1 of 1 (latest)
👋 U can use the user$ observable exposed on the AuthService.
That has the sub claim.
const sub$ = this.auth.user$.pipe(map(user => user.sub));
Curious why u need the users sub to be sent tho.
Sounds insecure, why not read it from the token server side ?
Im unsure how to do that
The idea of a token is to prove who u are
Sending ur id as an identification outside of it makes it easy to tamper with
Are u sending the token to the backend ?
Yeah
How would I access it from the back-end?
I hope you are already validating the token .
But it will depend on the frameworks used
This is just for a test kinda thing I'm working on atm I think using this will be sufficient. The only issue im having is that it is inside an object. How would I be able to access it?
It's a bad idea tho.
Read it from the token, as it should be.
Happy to show u how, if u would elaborate on the backend framework being used
Im using flask atm
So u use the angular SDK on the angular side, and what's mentioned in the python quickstart in the python side.
Both will expose the info of the user
I believe the python code in the link should expose things on _request_ctx_stack.top.current_user.
So if u have everything set up, all your application should do is take the sub from the requests current_user on python side.
Seems like little to do with the issue at hand, nor does it mention angular.