---
name: "WebAuth::Token::Error"
section: "3pm"
platform: "linux"
package: "libwebauth-perl"
version: "4.7.0-8"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/WebAuth::Token::Error"
---

# WebAuth::Token::Error(3pm)

WebAuth error tokens

## NAME

WebAuth::Token::Error - WebAuth error tokens

## SYNOPSIS

```
    use WebAuth qw(WA_PEC_LOGIN_CANCELLED);
    my $token = WebAuth::Token::Error->new;
    $token->code (WA_PEC_LOGIN_CANCELLED);
    $token->message ('user canceled login');
    $token_>creation (time);
    print $token->encode ($keyring), "\n";
```

## DESCRIPTION

A WebAuth error token, returned by the WebKDC in response to a request token if some error occurred in processing that request.

## CLASS METHODS

- new ()

  Create a new, empty WebAuth::Token::Error.  At least some attributes will have to be set using the accessor methods described below before the token can be used.

## INSTANCE METHODS

As with WebAuth module functions, failures are signaled by throwing WebAuth::Exception rather than by return status.

## General Methods

- encode (KEYRING)

  Generate the encoded and encrypted form of this token using the provided KEYRING.  The encryption key used will be the one returned by the **best\_key()** method of WebAuth::Keyring on that KEYRING.

## Accessor Methods

- code (\[CODE\])

  Get or set the error code, which should be one of the WA\_PEC\_\* error codes exported by the WebAuth module.

- message (\[MESSAGE\])

  Get or set the error message.

- creation (\[TIMESTAMP\])

  Get or set the creation timestamp for this token in seconds since epoch. If not set, the encoded token will have a creation time set to the time of encoding.

## AUTHOR

Russ Allbery \<eagle@eyrie.org\>

## SEE ALSO

**WebAuth**(3), **WebAuth::Keyring**(3), **WebAuth::Token**(3)

This module is part of WebAuth.  The current version is available from \<http://webauth.stanford.edu/\>.
