dev-rroslan
Hi,
I am trying to create a magic link to a targeted survey.
An agent will create a magic link and message the link to the targeted survey takers.
Any advice is much appreciated. Thank you.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
codeanpeace
Just to clarify, by magic link, you’re referring to links that offer passwordless authentication and, in your case, automatically redirects a survey taker to the appropriate target survey, right?
If so, take a look at these two articles on how to implement passwordless authentication:
https://dennisreimann.de/articles/phoenix-passwordless-authentication-magic-link.html
At a high level, I imagine the token embedded in the url will need to capture at minimum two identifiers:
A potential gotcha is that the survey taker identifier will not be sufficient for situations where the a person is sent multiple targeted surveys through the same identifiers – hence the survey identifier in addition to the survey taker identifier.
Off the top of my head, some questions/requirements to consider:
dev-rroslan
The survey takers would not need to login
The survey agent who is logged in visits the survey taker and create a uuid, a redirect and the magic link to a survey, so the link is good for 15 mins and one time use.
The output will be the url, which is copied and pasted in message.
The survey takers can do the survey in the browser.
Thank you. I hope it is possible
dev-rroslan
or instead of uuid, could be a hidden input field for phone number, jf it is accessible>Could it?
D4no0
Just use a JWT token with specific audience, you could even encode more necessary data inside. The signature is done by the private key you have on your server, so you can ensure that the token was emitted by you and is valid.
You can receive the token in any of your endpoints as a param:
https://my.app/survey?token={your_jwt_token}codeanpeace
Phoenix has a built-in module Phoenix.Token for creating, signing, and verifying tokens that is worth checking out. It’s also used in both the links shared earlier, I’d give them a read even if you don’t need to login the survey taker.
By “survey agent”, are you referring to the person owning/creating the survey? And that this interaction happens in person?
And is the uuid the identifier representing the survey?
dev-rroslan
Most of the time we need a survey agent who can sign in using the mix phx.gen.auth. We need the survey agents because most of the time we need good survey samples.
From what I understand from above conversations, the survey agents will login and create a magic link, using token and a redirect by creating a token module.
Token should not be in db, active for 15 mins.
I think that’s what I need. Any comments is welcome.