FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Generate Authentication Token by default

    Scheduled Pinned Locked Moved
    Q&A
    3
    4
    357
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pierrot.corbel
      last edited by pierrot.corbel

      Hello there,

      I have a use-case, where I want for each new user, to always generate an Application Authentication Token.

      How can I configure FusionAuth do that automatically?
      In other terms, how can I configure FusionAuth to change the default value of generateAuthenticationToken to true?

      And if it is not possible yet, is it possible to generate it in a programmatic way from the client-side (a Vue app just after user logged in) without exposing an API key?
      So in other terms, is it possible for a logged in user to register once again with the parameter generateAuthenticationToken?

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        How can I configure FusionAuth do that automatically?

        This is not possible through FusionAuth configuration. Feel free to file a feature request: https://github.com/fusionauth/fusionauth-issues/issues

        You can update a user after they are created to specify an application authentication token. So you could register a webhook and listen for registration events and then update the user who just registered: https://fusionauth.io/docs/v1/tech/apis/registrations/#update-a-user-registration

        And if it is not possible yet, is it possible to generate it in a programmatic way from the client-side (a Vue app just after user logged in) without exposing an API key?

        Nope, you'll need some server side code or you'll need to expose an API key. You could limit the API key to only be able to update users, but you would need to make an API call to update the user and generate the auth token.

        HTH.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • robotdanR
          robotdan
          last edited by

          @pierrot-corbel said in Generate Authentication Token by default:

          generateAuthenticationToken

          You can set generateAuthenticationToken equal to true in your code.

          So if I understand - I think what you're asking for is - each time a user is created in the UI by an admin user, or by FusionAuth as part of a login workflow using Facebook, Google (etc), and any other path to create a User Registration that is not explicitly done by using the User Registration API? Or perhaps even setting a global default so you do not have to set this API request parameter.

          1 Reply Last reply Reply Quote 0
          • P
            pierrot.corbel
            last edited by

            Great, thanks a lot
            I will indeed use a server-side function with an API token which will be called from the user.create webhook 👍

            1 Reply Last reply Reply Quote 2
            • First post
              Last post