Skip to content

Modify base_url or _email_link generation on a per action basis #278

Answered by janko
FelipeBodelon asked this question in Q&A
Discussion options

You must be logged in to vote

Since there are no validation errors, this most likely means the token was invalid. You can verify that by setting error reason in the JSON response, then checking if it matches invalid_verify_account_key.

set_error_reason { |reason| json_response[:error_reason] = reason }

The reason it's invalid is because rodauth-rails configures Rodauth to use HMACs, which requires hashed tokens to be passed to email links, and you're passing the raw token. That's why overriding base_url was working for you, because it wasn't changing the token. So, it's have to be

def verify_account_email_link
  "#{ENV.fetch("MEMOORIAS_APP_URL", "http://localhost:3001")}/auth/verify-account?#{verify_account_key_param}=#{

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@FelipeBodelon
Comment options

@janko
Comment options

@FelipeBodelon
Comment options

@janko
Comment options

Answer selected by FelipeBodelon
@FelipeBodelon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants