Way to issue token on server


Is it currently possible to issue a token for a user on the server side?

My use case is for passwordless authentication, so a user will authenticate by clicking a link in their email and then I’d like to issue them with a token on the server side. However because there are no passwords, I can’t use Fauna’s built in Login function.

Any help/advice is appreciated.

You don’t need password to create a token, just an instance to associate it to.

bob> Create(Tokens(), {instance: Ref(Collection("foo"), "1")})
  ref: Ref(Tokens(), "270223175747371527"),
  ts: 1593963752410000,
  instance: Ref(Collection("foo"), "1"),
  secret: 'XXXX'

This might also be interesting to you. Just shows a use case for generating tokens with Create(Tokens()...

1 Like