![ticket-agent](https://user-images.githubusercontent.com/34389545/124150714-6cf5f380-da57-11eb-851a-c75d31c763ef.png) # Ticket-Agent - Simple Session Auth As A Service ## The problem: Imagine you're a user who just saw a cool thing on Hacker News and you want to give it a try, so you shoot over to the website and surprise, you can't demo anything without an email/password signup. Bummer! ## A solution: Email and password is an abrupt way to get users onboarded. Instead, register a token on the first visit, and refresh the token with each request until signup. ### Consider an example: Imagine you're making an image hosting service, and you want users to glide into a signup as smooth as possible. There is no amount of sugar coating that will take the sting out of gating 100% of the functionality behind an email/password signup. One option is to use simple session auth validation like this: 1. On the first page load, generate a token for the user session 2. For each request, consume the current token, and deliver a new token. 3. Allow the user to use the service, upload some images and create some albums. 4. Prompt for signup conversion only when advanced features or credential backup are required. At this point, all of the data created during demo can be associated with the new signup account, giving the user a seamless user session experience at their own pace. ## Try it! Generate a new token ```shell curl --request GET \ --url https://trtl.id/v0/new/trtl/12.23.38.45 ``` And you should receive a response like this: ```json { "ApplicationID": "trtl", "TokenStr": "4f5b1c460096e74ab9a956c5c05c0b710d025f373f49a7f8456f600eeafdac54aeafece5333ac08dd89d85a3ede6dc8b8c0a2a6d675baf1be2c2e60624d0bf13", "Timestamp": "1625155006" } ``` Consume the new token: ```shell curl --request GET \ --url https://trtl.id/v0/use/trtl/4f5b1c460096e74ab9a956c5c05c0b710d025f373f49a7f8456f600eeafdac54aeafece5333ac08dd89d85a3ede6dc8b8c0a2a6d675baf1be2c2e60624d0bf13 ``` And you should receive a response with a new token like this: ```json "6d799b935b9d6588e18106a3c7cc2355d0f03b68e7332690e7ef720519dc407fa1bbf14487d427c947b0e49f78500280b0ce6ed8231cd1ba79193d859b408491" ``` ## API Routes: Generate a new token ``` https://trtl.id/v0/new/{appID}/{conn.Remote} ``` Consume an existing token ``` https://trtl.id/v0/use/{appID}/{token} ``` View ticket-agent performance stats ``` https://trtl.id/v0/stats ``` View issued tokens ``` https://trtl.id/v0/admin/{admin-token} ```