#Angular with Auth0 integration

27 messages · Page 1 of 1 (latest)

proper warren
#

I'm trying to pass the user.sub value from auth0 through a form to be sent in a post request but my form control name is restricting me from setting the value in the form. I also cant seem to find out how to access auth0 user.sub from ts as that would also solve my issue.

pseudo sparrow
#

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 ?

proper warren
#

Im unsure how to do that

pseudo sparrow
#

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 ?

proper warren
#

Yeah

pseudo sparrow
#

The backend should allready know the sub of the user

#

As it's inside the token

proper warren
#

How would I access it from the back-end?

pseudo sparrow
#

I hope you are already validating the token .

#

But it will depend on the frameworks used

proper warren
pseudo sparrow
#

Read it from the token, as it should be.

#

Happy to show u how, if u would elaborate on the backend framework being used

proper warren
#

Im using flask atm

pseudo sparrow
#

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.

pseudo sparrow
#

Seems like little to do with the issue at hand, nor does it mention angular.