Create API token automatically for each registered user

Hello,

users in my app sends data to database over API workflows. Every user has own API token (bearer) for authentication. To this time, i created API tokens manually a re-write it to DB, where was tagged as “available”. And when some user made registration, token was assigned to him.

Problem is, that i cant create tokens manually like that when app will expand.

Please, is possible to automatically create API Token (Bearer), which will be used by users api authentication?

Thank you.

Best,
Michal

You could do one of two things off the top of my head:

  1. Simpler method:
    Why aren’t you creating 50 api tokens at once (or 100, or 1000) and then saving as a csv and then uploading that csv to bubble. Then in that bubble database, you have a field which links to a user which associated a token to a user. When a new user signs up, you look for the next unlinked token and link them with that one.
  2. More complicated method
    Everytime a user signs up, you create a webhook which connects with your api to send a hashed copy of the user’s unique ID. Your api then creates this as the next token and on the bubble side, it saves the hashed version to the user record. (I’ve never set this up myself and could be using the terminology slightly incorrectly but there are plenty of tutorials online of how to connect outside applications to you bubble database (i.e. them pulling info from bubble, instead of the other way around))

Obviously you’ll have to make sure you have the correct privacy rules in place.

Thanks for reply Paul but i mean this tokens:

So, if i need to authenticate workflow, user must have API token generated there.

One way is to set up workflow without authentication and trigger it only when user send some expected token. But im not sure if it correct way.

Oh. I see

I read it but unfortunatelly dont understand how to do that… Could you please explain it a little more?

I’ve never done this before but this paragraph:

is set up by doing what @seanhoots is saying to do in this thread:

Then when you connect your external app to bubble via the bubble api, it will return the auth token which is what you use to authenticate the user.