Skip to content

Unable to log in using local dev #475

Closed
Closed

Description

@danrademacher

Ruben can you confirm that logging in locally is working for you when also proxying to the staging database?

Here's what's happening for me:

  1. I confirmed I am running the proxy:

image

  1. Rails server is running in web docker image:

image

  1. localhost resolves to OHM website and works normally:
    image

  2. unless I try to log in, in which case I get:
    image

The app fails until I reboot the Rails webserver by doing ctrl-C and bundle exec rails server -p 80 inside the container

I went through the steps at https://github.com/OpenHistoricalMap/ohm-deploy/blob/staging/images/DEVELOPMENT.md twice to be sure I wasn't missing anything, but still not working.

This is making it hard to test #395 inside OHM Rails app locally

Activity

  1. added
    infrastructure
    on Oct 17, 2022
  2. Rub21 commented on Oct 18, 2022

    @Rub21
    Member

    @danrademacher I can not login as well, some weird error about Can't verify CSRF token authenticity., we need to check a bit more.

    Warning! ActionDispatch::Session::MemCacheStore failed to save session. Content dropped.
    I, [2022-10-18T19:05:27.704962 #487]  INFO -- : [e61ad535-bf28-424f-abd9-c36a42e57838] Started POST "/login" for 192.168.144.1 at 2022-10-18 19:05:27 +0000
    I, [2022-10-18T19:05:27.712393 #487]  INFO -- : [e61ad535-bf28-424f-abd9-c36a42e57838] Processing by SessionsController#create as HTML
    I, [2022-10-18T19:05:27.719100 #487]  INFO -- : [e61ad535-bf28-424f-abd9-c36a42e57838]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"SlR7RcQYQAQUGQnOA75TLl--9dHLNbUZyIKK9JwyAVyCGUx1VJmhBZ7LYrcQ9WOsauSMdvjVSD6iJ9I6xfODhQ", "referer"=>"/#map=5/51.468/-0.110&layers=O", "username"=>"Rub21", "password"=>"[FILTERED]", "remember_me"=>"0", "commit"=>"Login"}
    W, [2022-10-18T19:05:27.732533 #487]  WARN -- : [e61ad535-bf28-424f-abd9-c36a42e57838] Can't verify CSRF token authenticity.
    I, [2022-10-18T19:05:31.383859 #487]  INFO -- : [e61ad535-bf28-424f-abd9-c36a42e57838] Redirected to http://0.0.0.0/#map=5/51.468/-0.110&layers=O
    I, [2022-10-18T19:05:31.391012 #487]  INFO -- : [e61ad535-bf28-424f-abd9-c36a42e57838] Completed 302 Found in 3660ms (ActiveRecord: 2266.1ms | Allocations: 20292)

    Also I have made some updates ini the way to access to the development mode OpenHistoricalMap/ohm-deploy#189
    cc. @batpad

  3. danrademacher commented on Nov 7, 2022

    @danrademacher
    Author

    @Rub21 and @batpad did you two find a time to look at this issue yet? We're a bit blocked on local testing of certain things, like iD, until we can again log in locally.

  4. batpad commented on Nov 8, 2022

    @batpad

    @danrademacher we did spend some time looking, unfortunately no cheese :(

    Do we know if this ever worked? Afaik, when we were testing login issues locally previously, it was with a local database. As I understand, this continues to work - the login only fails when attempting to use the staging database via port forwarding. Would just be useful if we had an idea if this is a recent regression / ever worked, etc.

    We did see some errors to do with memcache in the logs, and so spent some time trying to mess with the memcache settings, including trying to forward the staging memcached locally and use that.

    Since it works with a local database, this is definitely something to do with using the staging database, and that causing something to fail the verification of the CSRF / authenticity token sent with form submissions. We had a strong hunch that also using the staging memcache would fix this, but unfortunately the same error seems to persist.

    Am a bit unsure what to try next - might need to do some reading on Rails and how it signs and verifies CSRF tokens.

    cc @Rub21

  5. danrademacher commented on Nov 8, 2022

    @danrademacher
    Author

    Yes, this did work in the past — I’m not sure when it stopped, but certainly it worked when we were modifying iD in the past for date filters. I logged in with local testing to staging many times for that — I’ve never set up a local database at all

  6. Rub21 commented on Nov 8, 2022

    @Rub21
    Member

    @batpad @danrademacher ,I have been looking a bit more at this issue, for some reason it does not work with the staging-db.

    So. I have tried with the local DB and I have created a user and login, it went ok, but it still needs some auth token configuration.

    I have tried to create the auth OAuth 2 applications, but it requires that URL should be https, in our local environment we can not set Https URL, it may need some extra configuration.

  7. danrademacher commented on Nov 8, 2022

    @danrademacher
    Author

    I see. So this probably stopped working in the summer when we updated OSM upstream, when OAUTH2 came online for us, right?

    If so, then this wouldn't be unique to us. I wonder if folks in OSM dev community have methods for dealing with this.

  8. 1ec5 commented on Nov 8, 2022

    @1ec5
    Member

    I’ve never gotten OAuth to work in JOSM either for the OHM server, so I just assumed it was the same issue with iD. 🤔

  9. Rub21 commented on Nov 9, 2022

    @Rub21
    Member

    Here the PR that contains the documentation to setup a Dev environment: OpenHistoricalMap/ohm-deploy#189, Confirmed by @danrademacher

  10. danrademacher commented on Dec 28, 2022

    @danrademacher
    Author

    Resolved with new localdev using only ohm-website

  11. added theissue type on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

infrastructure

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions