📊
Pollz
  • Introduction
  • Quickstart
  • Guides
    • Initializing your app
    • Create a Poll
    • Vote for a Poll
    • Retrieve a Poll
    • Manage Poll Options
    • Listen to update
    • Anonymous Poll
  • Components
    • React
    • React Native
    • Embedded
  • API Reference
    • init()
    • pollOptions()
      • addOption()
      • deleteOption()
      • renameOption()
    • anonymous
      • createAnonymousToken()
      • getAnonymousPoll()
      • voteAnonymously()
    • polls
      • create()
      • get()
      • getAll()
      • vote()
      • rename()
      • deleteOne()
      • listen()
    • pollTypes
      • getAll()
  • Tooling
    • Typescript
    • React
      • usePoll()
      • usePolls()
      • usePollz()
      • usePollTypes()
      • useAnonymousPoll()
Powered by GitBook
On this page
  1. API Reference
  2. anonymous

createAnonymousToken()

createAnonymousToken(pollId: number): Promise<string>

Generate an anonymous voting token for a specific poll.

Parameters:

  • pollId (number): The ID of the poll for which to generate the anonymous voting token.

Returns:

  • A Promise resolving to the generated anonymous voting token.

Example:

const anonymousToken = await pollz.anonymous.createAnonymousToken(1);
console.log('Anonymous Token:', anonymousToken);

The createAnonymousToken method allows you to generate a unique anonymous voting token for a specified poll. Users can use this token to anonymously participate in the corresponding poll without revealing their identity.

The generated token is essential for casting anonymous votes and retrieving poll information associated with anonymous submissions.

Note: Ensure that the provided pollId exists and corresponds to an active poll in the system.

PreviousanonymousNextgetAnonymousPoll()

Last updated 1 year ago