Programmatically generate access token for API testing without showing connection in universal page

Hi, I’m struggling to find a way to generate an access token for E2E testing (I only do API testing with it, I do not interact with the SPA programmatically) for a manually created database user for testing. I read about Password realm, but didn’t manage to get it working, steps I’ve taken:

  1. Select grant_type Password for my SPA application in my staging tenant
  2. Verify email manually of database user
  3. Enable connection in the app - I do not want this because it shows on the universal page, and we do not have database connection, just social
curl --request POST \
  --url 'https://.../oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type="http://auth0.com/oauth/grant-type/password-realm" \
--data audience="..." \
--data scope="openid offline_access profile email" \
--data client_id="..." \
--data client_secret="..." \
--data realm="..." \
--data username="..." \
--data password="..."
{"error":"invalid_request","error_description":"Connection must be enabled for this client to perform single user creation and signup operations (client_id: ... - connection: ...)"}%

We have social, and passwordless with email connections enabled for the app. What are my options?

Thanks!

Hi @rendez,

Welcome to the Auth0 Community!

Thank you for posting your question. If you want to create an access token from this specific application, I’m afraid it won’t be possible without enabling the database connection for this application. Another approach, if your goal is to use the Access Token with API only, is to create a separate application with a database connection enabled to create an access token for your API. It’s not entirely aligned with E2E general guidelines, but you can try this approach. If that won’t be possible, I would encourage you to open up a new thread in the Product Feedback category explaining your use case and vote on it!

Thanks
Dawid

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.