Skip to content

Allow null tokens and provide immediate failure responses #10

Description

@Firehed

While a null token during auth or registration will never work, allowing it through can result in some ergonomic improvements - especially when using vanilla PHP without a framework:

Before:

$token = $_POST['token'] ?? null;
if ($token === null) {
  // do something
}
try {
  $auth = $snapAuth->verifyAuthToken($token);
} catch (\SnapAuth\ApiError $e) {
  // do something
}

After:

try {
  $auth = $snapAuth->verifyAuthToken($_POST['token'] ?? null);
} catch (\SnapAuth\ApiError $e) {
  // do something
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions