ApiKeys.CreateAsync HTTPError: http error code considered fatal. Client Error: 403

Hi , when i try to add ApiKey to Anonymous user we receive this message HTTPError: http error code considered fatal. Client Error: 403.

If User is mail/pwd authenticated no error occurs.

var key = await realmUser.ApiKeys.CreateAsync(“ApiKey”);

2024-05-23 18:40:23.701 Debug: App: do_authenticated_request: POST https://us-east-1.aws.realm.mongodb.com/api/client/v2.0/auth/api_keys
Exception thrown: ‘Realms.Sync.Exceptions.AppException’ in System.Private.CoreLib.dll

image

Anonymous users cannot create API keys.

You can generate user API keys with the Realm SDKs. Each user API Key is associated with a single non-anonymous user.

From https://www.mongodb.com/docs/atlas/app-services/authentication/api-key/#user-api-keys

1 Like

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