Is there a way to generate a magic link and not email it to the member?
For example, if I wanted to push message (ie: SMS or support ticket) with a magic link.
Yes, but it’s undocumented. You basically want the same process as is used when you use the admin panel, visit a specific user’s page, and click impersonate. If you sniff the network traffic (use your browser’s dev tools - F12), you can see what happens to generate that link, and replicate it.
Tip: Doesn’t work with an API key - you’ll have to use a cookie.
Thanks for the tip.
#feelsbadman about the API key.
If you want to see a python version that requires a username and password (must be an admin)… behold the gory details:
I went with:
- Create jwt from api key
- use jwt to locate member by email
- get member ID
- log in an admin and get a session (cookie)
- using admin cookie, send a request to the signin url with the member ID
- get the link in the response
I feel like this should definitely work with a jwt but I see you already opened an issue on that and there was no work scheduled.
Thanks again. Now that I think about it I could implement Login with Discord in an afternoon with this method.
Since this thread got bumped, a quick update. I patched the Ghost core (and that PR got merged at about 5.96ish) so that now you can call this endpoint with a jwt from the api key. You do still have to generate a jwt, just like all uses of the admin api key, but at least you don’t have to fake an admin cookie any more! :)