B2B Saas Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Passwords

/

Strength Check

Strength check

The strengthCheck method wraps the Strength Check Password API endpoint.

This endpoint allows you to check whether or not the Member’s provided password is valid, and to provide feedback to the Member on how to increase the strength of their password.


Method parameters


password*string

email_addressstring

Response fields


request_idstring

status_codeint

breach_detection_on_createboolean

breached_passwordboolean

scoreint

strength_policyint

valid_passwordboolean
import React, { useCallback } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytchB2BClient } from '@stytch/react-native/b2b';

export const StrengthCheck = () => {
  const stytch = useStytchB2BClient();

  const strengthCheck = useCallback(() => {
    stytch.passwords.strengthCheck({
      password: 'q8Zs)L0t1Emx_I61',
    });
  }, [stytch]);

  return (
    <View>
      <TouchableOpacity onPress={strengthCheck}>
        <Text>Strength Check</Text>
      </TouchableOpacity>
    </View>
  );
};

RESPONSE

200 - LUDS invalid
{
    "breach_detection_on_create": true,
    "breached_password": false,
    "feedback": {
      "suggestions": null,
      "warning": null,
      "luds_requirements": {
        "has_digit": true,
        "has_lower_case": false,
        "has_symbol": false,
        "has_upper_case": false,
        "missing_characters": 6,
        "missing_complexity": 1
      }
    },
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "score": 0,
    "status_code": 200,
    "strength_policy": "luds",
    "valid_password": false
}