Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

How to generate JWT token for a user without calling .login(email, password)?

default discord avatar
bombnp2 years ago
2

I am using Google OAuth to authenticate my users. When I receive google id token, I would verify it and then find the user with the corresponding email. However, I don't know how to generate the JWT for that specific user via local API without specifying email and password (especially since there's no password)



Or is it not supported at the moment?

  • discord user avatar
    dribbens
    2 years ago

    Hey, there is a lot that goes into making your auth strategy. It is tough to explain the details, but you'll need to sign your own JWT in a new custom endpoint route and use the

    disableLocalStrategy

    auth option as that will turn off the built-in email + password fields along with other auth features you won't want under your strategy.



    This was a really good write up on what you need in another community-help post that could help:

    https://discord.com/channels/967097582721572934/1073356002101035108/1073672246503166022
  • default discord avatar
    bombnp2 years ago

    oh my that really is extensive. I've implemented it like that as well. Thanks for reply!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.