• Members 5 posts
    Sept. 23, 2019, 10:42 a.m.

    Hello, I've been trying to find the best way of implementing Steam OpenID but without editing a handful of files a bit blindly I figured I should ask first what's my best route to take. I saw in the docs that since it uses Python Social Auth which already has Steam it shouldn't be too difficult... yet I'm still clueless as to how to add it when the only other options are OAuth and I'm trying to add OpenID.

    I was hoping the SSO would be a quick fix but have a feeling that might be only for Django SSO? I get an error,

    [2019-09-10 05:53:39,120] ERROR Internal Server Error: /sso/client/
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
        response = get_response(request)
      File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
        response = self.process_exception_by_middleware(e, request)
      File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
        return self.dispatch(request, *args, **kwargs)
      File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
        return handler(request, *args, **kwargs)
      File "/usr/local/lib/python3.7/site-packages/misago/sso/client.py", line 31, in get
        return super().get(request)
      File "/usr/local/lib/python3.7/site-packages/simple_sso/sso_client/client.py", line 31, in get
        request_token = self.client.get_request_token(redirect_to)
      File "/usr/local/lib/python3.7/site-packages/simple_sso/sso_client/client.py", line 98, in get_request_token
        return self.consumer.consume(url, {'redirect_to': redirect_to})['request_token']
      File "/usr/local/lib/python3.7/site-packages/webservices/models.py", line 56, in consume
        return self.handle_response(body, max_age)
      File "/usr/local/lib/python3.7/site-packages/webservices/models.py", line 59, in handle_response
        return self.signer.loads(body, max_age=max_age)
      File "/usr/local/lib/python3.7/site-packages/itsdangerous/timed.py", line 142, in loads
        raise last_exception
      File "/usr/local/lib/python3.7/site-packages/itsdangerous/timed.py", line 130, in loads
        base64d, timestamp = signer.unsign(s, max_age, return_timestamp=True)
      File "/usr/local/lib/python3.7/site-packages/itsdangerous/timed.py", line 79, in unsign
        text_type(sig_error), payload=value, date_signed=timestamp
    itsdangerous.exc.BadTimeSignature: Signature b'com/subscriber_agreement/" target="_blank">Steam Subscriber Agreement</a>\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t</span>\r\n\t\t</div>\r\n\t\t\t\t\t<div class="responsive_optin_link">\r\n\t\t\t\t<div class="btn_medium btnv6_grey_black" onclick="Responsive_RequestMobileView()">\r\n\t\t\t\t\t<span>View mobile website</span>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t</div>\r\n\t\r\n\t</div>\t<!-- responsive_page_content -->\r\n\r\n</div>\t<!-- responsive_page_frame -->\r\n</body>\r\n</html>' does not match

    Also, I tried searching for "Steam" and didn't find anything and also "OpenID" and still nothing so here I am hoping for some more guidance. Otherwise I was blindly trying to find a way to edit the pre-existing OAuth entries to allow for OpenID... but wasn't really getting anywhere.


  • Sept. 23, 2019, 6:23 p.m.

    Marked as best answer by Sept. 24, 2019, 9:48 a.m..

    Hello Taco!

    To add Steam login, you need to create custom Django app that registers it as social login provider in Misago. Here is example for other integrations:


    So your Django app would have to call misago.socialauth.providers.providers.add() with Steam OpenID backend, and also implement template and Django form for setting its configuration. Misago will take care of rest.

  • Members 5 posts
    Sept. 25, 2019, 10:52 a.m.

    Hmm, so I was going to create a new thread but it still seems related to this in a sense that I was simply trying to add Steam but have commented out the few lines I added to start over yet I don't seem to be where I began. I also tried enabling the Debug Toolbar to only receive more errors, so I'm not sure what happened or what I should do so I figured a quick post might help me.

    First off, when experimenting and enabling SSO I noticed it disabled registration but I thought this was normal since I was seeing it error anyway and when I turned it off I at least assumed it re-enabled normal registration but apparently not. I checked the logs but didn't see anything, so I checked console and got this:

    misago.js? [sm]:132 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
        at i (misago.js? [sm]:132)
        at p._constructComponentWithoutOwner (vendor.js? [sm]:19430)
        at p._constructComponent (vendor.js? [sm]:19406)
        at p.mountComponent (vendor.js? [sm]:19309)
        at Object.mountComponent (vendor.js? [sm]:25596)
        at mountChildren (vendor.js? [sm]:25000)
        at m._createInitialChildren (vendor.js? [sm]:20832)
        at mountComponent (vendor.js? [sm]:20651)
        at Object.mountComponent (vendor.js? [sm]:25596)
        at mountChildren (vendor.js? [sm]:25000)

    It seems to be related to Social Auth?

     if (socialAuth.length === 0) return null;

    Not sure what to do, I've tried fiddling around with settings again and rebuilding but I get nowhere. Secondly, trying to enable the Debug Toolbar which I was hoping might help with this I get a similar error in console:

    toolbar.js:307 Uncaught ReferenceError: djdt is not defined
        at toolbar.js:307
    toolbar.timer.js:51 Uncaught ReferenceError: djdt is not defined
        at toolbar.timer.js:51
    toolbar.sql.js:10 Uncaught ReferenceError: djdt is not defined
        at toolbar.sql.js:10

    Perhaps this isn't useful but when trying to load /__debug__/render_panel/ I get a MultiValueDictKeyError for 'store_id', when I looked it up I could only find an issue on GitHub saying to upgrade their Debug Toolbar version but I'd imagine everything should be working out of the box yet I just seem to be lucky.

    My only thought is to try and reinstall everything, although I'm not too sure how to even do that properly -- what's my best course of action?


  • Sept. 25, 2019, 11:33 a.m.

    If you enable SSO, Misago will display warnings for you around the admin panel that this disables built-in user creation features (like registration), and will delegate those to the site you've specified when enabling it. Built-in SSO is not generic, because it doesn't have to be. You are supposed to be server provider for it, so extra authentication and security mechanisms that Steam requires are skipped in it.

    The JS thing you are describing here may be a bug. Can you share a link to your site? What social auth methods are displayed when you run console.log(misago._context.SOCIAL_AUTH) in your browser's console?

  • Members 5 posts
    Sept. 25, 2019, 1:24 p.m.

    I kind of learned that after the fact but I'll figure out setting up Steam separately I was just hoping to re-enable the default registration in the meantime.

    Sure, taco-land.net/ should get you there hopefully! This is what I get when I run that in console:

    04:18:19.293 VM220:1 []length: 0__proto__: Array(0)

    I also tried setting up Twitter to see if that might get around things, and it didn't... although it did show up when I ran that command.

    Also a side note, maybe unrelated -- I had some issues forwarding the Docker port to my current Nginx setup until recently but I still notice it will randomly pop up saying "Lost connection to application" and/or "TOO MANY REDIRECTS" in console which is what I was getting before although the site seems to work now.


  • Sept. 25, 2019, 11:44 p.m.

    I've checked your site and you are experiencing this error because it was not updated correctly - misago.js your site is using is not one that Misago 0.22 implements. I would assume it may be the same for misago.css as well.

    Also a side note, maybe unrelated -- I had some issues forwarding the Docker port to my current Nginx setup until recently but I still notice it will randomly pop up saying "Lost connection to application" and/or "TOO MANY REDIRECTS" in console which is what I was getting before although the site seems to work now.

    So you are using custom setup instead of misago_docker? I guess running python manage.py collectstatic and restarting your nginx should fix the outdated js and css problems, but I can't offer more advice about other problems you've experienced. :(

  • Members 5 posts
    Sept. 26, 2019, 2:25 a.m.

    Hmm, so how would I update it properly then? I've ran the Docker as intended with appctl but not too sure how it wouldn't have updated properly - makes sense though. If I can't update it is there a proper way of reinstalling everything? Or am I overthinking things and just need to get a bash shell into it and pip upgrade stuff? This is what pip list gives me, I don't think I see anything out of order though:

    Package                Version  
    ---------------------- ---------
    amqp                   2.5.0    
    ariadne                0.5.0    
    atomicwrites           1.3.0    
    attrs                  19.1.0   
    beautifulsoup4         4.7.1    
    bleach                 3.1.0    
    celery                 4.3.0    
    certifi                2019.6.16
    chardet                3.0.4    
    defusedxml             0.6.0    
    Django                 2.2.3    
    django-anymail         6.1.0    
    django-debug-toolbar   1.11     
    django-htmlmin         0.11.0   
    django-js-asset        1.2.2    
    django-mptt            0.10.0   
    django-redis           4.10.0   
    django-simple-sso      0.14.0   
    djangorestframework    3.9.4    
    Faker                  1.0.7    
    GraphQL-core-next      1.0.5    
    html5lib               1.0.1    
    idna                   2.8      
    importlib-metadata     0.18     
    itsdangerous           1.1.0    
    kombu                  4.6.3    
    Markdown               2.6.11   
    Misago                 0.22     
    more-itertools         7.1.0    
    oauthlib               3.0.2    
    packaging              19.0     
    Pillow                 6.1.0    
    pip                    19.2.3   
    pluggy                 0.12.0   
    psycopg2-binary        2.8.3    
    py                     1.8.0    
    PyJWT                  1.7.1    
    pyparsing              2.4.0    
    pytest                 5.0.1    
    pytest-django          3.5.1    
    pytest-mock            1.10.4   
    python-dateutil        2.8.0    
    python-multipart       0.0.5    
    python3-openid         3.1.0    
    pytz                   2019.1   
    redis                  3.2.1    
    requests               2.22.0   
    requests-oauthlib      1.2.0    
    responses              0.10.6   
    sentry-sdk             0.10.1   
    setuptools             41.2.0   
    six                    1.12.0   
    snapshottest           0.5.0    
    social-auth-app-django 3.1.0    
    social-auth-core       3.2.0    
    soupsieve              1.9.2    
    sqlparse               0.3.0    
    starlette              0.12.2   
    termcolor              1.1.0    
    text-unidecode         1.2      
    typing-extensions      3.7.4    
    Unidecode              1.0.23   
    urllib3                1.25.3   
    uWSGI                  2.0.18   
    vine                   1.3.0    
    wcwidth                0.1.7    
    webencodings           0.5.1    
    webservices            0.7      
    wheel                  0.33.6   
    zipp                   0.5.2    

    And as far as a custom setup goes, I don't know how far I'd say it's custom - I just needed to change the ports since I was already using the one's it requires and forwarded them from my current Nginx. But I have already ran collectstatic several times hoping that would fix things, as I've had that luck in the past but not this time... sadly. Plus rebuilding several times... :(


  • Sept. 26, 2019, 12:29 p.m.

    I am certain that your Misago version is 0.22, because your backend generates data for such version - your frontend is simply not updated correctly.

    I don't know how far I'd say it's custom

    I guess you've only changed port number to custom one, but that was enough to bork appctl upgrade ;) Any edit to docker-compose.yml will clash git pull command that appctl upgrade runs, and we've recently changed how misago-docker stores static files, so there can be your conflict.

    You should create docker-compose.override.yml right next to docker-compose.yml to override ports for nginx service:

    version: '3.0'
          - "80:80"
          - "443:443"

    You can then customize your ports here.