class Stytch::M2M
def marshal_jwt_into_response(jwt)
def marshal_jwt_into_response(jwt) # The custom claim set is all the claims in the payload except for the standard claims. # The cleanest way to collect those seems to be naming what we want # to omit and filtering the rest to collect the custom claims. reserved_claims = %w[aud exp iat iss jti nbf sub] custom_claims = jwt.reject { |key, _| reserved_claims.include?(key) } { 'scopes' => jwt['scope'].split(' '), 'client_id' => jwt['sub'], 'custom_claims' => custom_claims } end