RSSAmplifier

Shorts · Sep 14, 2018

Verify Slack Requests in Rails

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Slack signs its requests so you can verify they’re authentic. Here’s a method you can use in your Rails controllers for it. def request_verified? timestamp = request.headers["X-Slack-Request-Timestamp"] signature = request.headers["X-Slack-Signature"] signing_secret = ENV.fetch("SLACK_SIGNING_SECRET") if Time.at(timestamp.to_i) < 5.minutes.ago return false # expired end basestring =…

Read on ankane.org

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.