Can you access random string in directus flows?

Hi i created a flow using the ui to programatically create a directus user on an action trigger. I wonder if there is any way we can run the random string utility for generating a static token in the flows?

2 Answers

2

Hi, Noel

There is an option in the flows to make a URL request. You can make a GET request to /utils/random/string

You can consider using a custom code block to generate a random string.

function generateRandomString32() {
    const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    let result = '';
    for (let i = 0; i < 32; i++) {
        result += chars.charAt(Math.floor(Math.random() * chars.length));
    }
    return result;
}