Sha256: 6810b243d6ee7727069c44af14a782434b6c2fb74b1acf9cfb8db757ba81f822

Contents?: true

Size: 326 Bytes

Versions: 3

Compression:

Stored size: 326 Bytes

Contents

Spree.user_class.class_eval do
  ##
  # Generate a json web token
  # @see https://github.com/jwt/ruby-jwt
  # @return [String]
  #
  def generate_jwt_token(expires_in: nil)
    SolidusJwt.encode(payload: as_jwt_payload, expires_in: expires_in)
  end

  private

  def as_jwt_payload
    as_json(only: %i[email id])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_jwt-0.0.2 app/models/spree/user_decorator.rb
solidus_jwt-0.0.1 app/models/spree/user_decorator.rb
solidus_jwt-0.0.1.pre app/models/spree/user_decorator.rb