Custom registration for user, and use registration response (and token) to continue process with this logged user
-
Hi,
I need to implement a custom workflow for user registration. Then, my angular app use an endpoint back to register, and this back return register response (combined) to Angular.
In my Angular app, how to continue as a logged user. Using access token provided by registration endpoint ? How to it with Angular FusionAuth SDK to use all others features in FusionAuth SDK. We need to customize only registration part.
-
Not sure exactly if this is what you need but probably you can implement your own backend app to communicate with FusionAuth however you see fit. Just like what I did here in NestJS. Then in my react app I have a normal form and then sends an HTTP request to my backend endpoint. So in other word I am not using
startLogin
helper function.Yes, I know it is not angular. But just to light your creativity I thought it is a good idea too look at it from a different perspective.
BTW I appreciate it if you could give my repo a star if it did help you.
-
@kasir-barati Thank you for help ! I think that, in your case, user needs to login after register. I would like to avoid login. After registration, FusionAuth api returns an access token. I do not know how to continue with it or maybe there are an other solution
-
@didier hmm, I guess you can do it by registering user in your backend (get username, and password from the user and register a user with those). Then you can just exchange the plain text username, password for JWT tokens and attch them to response cookies. Something like this: https://github.com/kasir-barati/you-say/blob/main/apps/backend-e2e/src/utils/login.util.ts.
If you're using FusionAuth Typescript client you can do it like this: https://github.com/kasir-barati/you-say/blob/main/packages/backend/auth/src/lib/services/mobile-auth.service.ts#L71