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

default discord avatar
7 months ago

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
    Payload Team
    7 months 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


    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:
  • default discord avatar
    7 months ago

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

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.