[openstreetmap/openstreetmap-website] Facebook deletion callback (PR #7093)

Pablo Brasero notifications at github.com
Thu May 21 17:00:14 UTC 2026


@pablobm commented on this pull request.



> +      if params.expect(:provider) == "facebook"
+        encoded_signature, payload = params.expect(:signed_request).split(".", 2)
+        signature = Base64.urlsafe_decode64(encoded_signature)
+        if signature == OpenSSL::HMAC.digest("SHA256", Settings.facebook_auth_secret, payload)
+          data = JSON.parse(Base64.urlsafe_decode64(payload))
+          user = User.find_by(:auth_provider => "facebook", :auth_uid => data["user_id"])
+
+          if user
+            user.auth_provider = nil
+            user.auth_uid = nil
+            user.save!
+
+            @confirmation_code = Rails
+                                 .application
+                                 .message_verifier(:social_login_deletion)
+                                 .generate([data["user_id"], Time.now.to_i])
+
+            render :formats => [:json]
+          else
+            head :not_found
+          end
+        else
+          head :bad_request
+        end
+      else
+        head :not_found
+      end

Full list of supported exceptions in [actionpack:/lib/action_dispatch/middleware/exception_wrapper.rb](https://github.com/rails/rails/blob/3dadd10c72f161460626002f152ae426b582c64e/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb#L12). Custom ones probably can be added (I don't remember from the top of my head).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7093#discussion_r3282941329
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7093/review/4338976203 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260521/fa82cca0/attachment.htm>


More information about the rails-dev mailing list