php8.5
Home/ Manual/ oauth / oauthprovider/ OAuthProvider::timestampNonceHandler

OAuthProvider::timestampNonceHandler

PHP function Edit on GitHub ✎

(PECL OAuth >= 1.0.0)

Set the timestampNonceHandler handler callback

Description

OAuthProvider::timestampNonceHandler(callable $callback_function): void

Sets the timestamp nonce handler callback, which will later be called with OAuthProvider::callTimestampNonceHandler. Errors related to timestamp/nonce are thrown to this callback.

Func

Parameters

callback_function

The callable functions name.

Return Values

Void

Examples

Example OAuthProvider::timestampNonceHandler callback

php
<?php
function timestampNonceChecker($provider) {

    if ($provider->nonce === 'bad') {
        return OAUTH_BAD_NONCE;
    } elseif ($provider->timestamp == '0') {
        return OAUTH_BAD_TIMESTAMP;
    }

    return OAUTH_OK;
}
?>

See Also

  • OAuthProvider::callTimestampNonceHandler

Source: reference/oauth/oauthprovider/timestampnoncehandler.xml · from the official PHP manual (php/doc-en)