Skip to main content
Some auth providers cannot call a hosted endpoint. They run code that you deploy instead. For three of them, NoResponse publishes one file that you copy into your project. The file calls POST /v1/assessments with your API key and acts on the account’s decision. All three files work in the same way:
  • They fail open. A missing key, an error, a slow answer or an unexpected reply lets the user through. The file writes one line to the log with the reason.
  • They refuse only on block. The decision is account.risk.decision. allow, step_up, review and a 202 pending answer let the user through. Use late decisions to act on them later.
  • They send no secret to another host. The key goes only to an https URL, and the files follow no redirect.
  • They drop a refused optional value. If the API refuses the IP, phone or name of the user, the file sends the request once more without that value.
Each file sends auth_context with transport provider_hook, so NoResponse knows which provider made the call. The file is the only code that you add. It needs no package beyond the SDK of your auth provider.
Every file needs a NoResponse API key with the assess scope. Use your test key (nrk_test_) first. Then the magic emails give a known decision, and each file refuses block@test.noresponse.org.

Better Auth

The plugin assesses each new user in databaseHooks.user.create.before. Better Auth calls this hook for email and password, social and magic link account creation. A refused user gets 403 with your message, and Better Auth stores no user. The plugin throws APIError, because a hook that returns false breaks social account creation. Better Auth has no user id at this point. NoResponse thus gives the assessment an account id of its own, pre: and then the assessment id.
1

Add the key

Set NORESPONSE_API_KEY in the environment of your auth server.
2

Copy the plugin

Save noresponse.ts next to your Better Auth configuration.
noresponse.ts
3

Add it to your configuration

auth.ts
The plugin reads the IP of the user from the headers that Better Auth uses for rate limits. That is x-forwarded-for, or advanced.ipAddress.ipAddressHeaders when you set it. A header with more than one address gives no IP. With advanced.ipAddress.disableIpTracking, the plugin sends no IP.

Firebase

The blocking function runs before Firebase Authentication saves a new user. Blocking functions need Firebase Authentication with Identity Platform. Firebase allows a blocking function 7 seconds and refuses the account creation after that. The function thus stops the call to NoResponse after 5 seconds. The function sends the Firebase user id as the account_id. On held, it creates the user disabled. Your late-result handler enables the user when the final decision is allow.
1

Add the key

Store the key
2

Copy the function

Save noresponse.ts in your functions folder and export the function from your entry file.
index.ts
noresponse.ts
3

Deploy and register it

Run firebase deploy --only functions. Then open Authentication, then Settings, then Blocking functions, and select noresponseBeforeCreate for Before account creation.

Amazon Cognito

The trigger runs before Cognito creates a new user. Cognito allows a trigger 5 seconds and can try it again. The trigger thus stops the call to NoResponse after 4 seconds, and each new try gets the same assessment. The trigger does not assess a user that an administrator creates with AdminCreateUser. Cognito cannot create a user disabled from this trigger. On held, the trigger thus lets the user through. Your late-result handler disables the user with AdminDisableUser when the final decision is block. The Cognito event carries no client IP. To send one, put it in ClientMetadata as noresponse_ip on the SignUp call from your backend.
1

Deploy the function

Put pre-sign-up.mjs and template.yaml in one folder. Then deploy them with the AWS SAM CLI and give the ARN of your user pool and your key.
Deploy
pre-sign-up.mjs
template.yaml
2

Attach the trigger

In the Cognito console, open your user pool, then Extensions, then Add Lambda trigger. Select Sign-up, then Pre sign-up trigger, and select the function.
Do not attach the trigger with aws cognito-idp update-user-pool alone. That command sets every setting that you do not include back to its default.

Tests

Each file has tests in its own folder of the NoResponse repository. They run the file with the real SDK of its auth provider against a scripted NoResponse endpoint. The tests cover each decision, each failure and the retry without a refused value.

Admission and late decisions

Act on a decision that changes after the account exists.

Test your integration

The magic emails that give each decision with a test key.