Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Invitation link implementation .NET WEB API

i`m developing .net web api pet application, that uses jwt authentication.

It has private rooms(lets say lobbies), so users dont have access to the list of them.

The idea is to create invitation link like https://mycoolapp.com/Room/sd1Fds/join=token,
so unauthorised user can click it and join room after he logs in.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The idea comes from discord invitation link
Like here

I want it to have expiration time, so user can choose between 3,5,7 hours for example.
Discord implementation

The question is, how should i implement it, i`m currently looking at SecurityToken class, is that right approach?

>Solution :

yes, the SecurityToken is a good point to start

you can create a room and generate a unique id (GUID) for that. then create a JWT token and include the generated unique id as a claim into it. then generate the invitation link including the JWT token and send it to guest

after the guest clicks on the link, redirect to the login page and then redirect to the API with the JWT token included in the query string. in the endpoint that handles the invitation link, check if everything is ok and the id exists as a claim, and the expiration time is ok, grant the user access to the private room

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading