Module: Grape::OAuth2::UniqueToken

Defined in:
lib/grape_oauth2/unique_token.rb

Overview

OAuth2 helper for generation of unique token values. Can process custom payload and options.

Class Method Summary collapse

Class Method Details

.generate(_payload = {}, options = {}) ⇒ String

Generates unique token value.

Parameters:

  • _payload (Hash) (defaults to: {})

    payload

  • options (Hash) (defaults to: {})

    options for generator

Returns:

  • (String)

    unique token value



15
16
17
# File 'lib/grape_oauth2/unique_token.rb', line 15

def self.generate(_payload = {}, options = {})
  SecureRandom.hex(options.delete(:size) || 32)
end