Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

OAuth2 integration for Discord #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

OAuth2 integration for Discord #21

wants to merge 5 commits into from

Conversation

tallypokemap
Copy link

@tallypokemap tallypokemap commented Aug 18, 2017

There will need to be substantial additions to documentation.
These instructions assume a nginx server on Ubuntu 16.04

You will need a discord bot user in your server. Here is a link on how to set it up: https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token

  1. sudo pip3 install virtualenv
  2. virtualenv env
  3. source env/bin/activate
  4. pip3 install -r requirements.txt
  5. deactivate
  6. set values in oauth2/config/config.ini
  7. move oauth2.service to /etc/systemd/system
  8. sudo systemctl enable oauth2 and sudo systemctl start oauth2
  9. add this to your site-enabled conf file
    location /login {
        include proxy_params;
        proxy_pass http://unix:/var/www/html/PMSF/oauth2/oauth2.sock:/login;
    }
  1. sudo systemctl restart nginx
  2. Probably some permission settings for your PATH/TO/PMSF, idk

What is still needed:

  1. better templates for when access is denied (for now it either says "ACCESS DENIED" or "INSUFFICENT ROLES"
  2. for to have a config option to disable oauth2 in index.php
  3. Better instructions that above and probably for varying OS's and also for Apache

@ARGG1
Copy link

ARGG1 commented Aug 20, 2017

Stuck at ..

`
systemctl start oauth2
[root@vpsxxxxxxx PMSF]# systemctl status oauth2
● oauth2.service - Gunicorn instance to serve oauth2
Loaded: loaded (/etc/systemd/system/oauth2.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2017-08-20 01:17:23 EDT; 4s ago
Process: 15388 ExecStart=/var/www/html/PMSF/oauth2/env/bin/gunicorn --workers 3 --bind unix:oauth2.sock -m 007 wsgi:app (code=exited, status=216/GROUP)
Main PID: 15388 (code=exited, status=216/GROUP)

Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Started Gunicorn instance to serve oauth2.
Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Starting Gunicorn instance to serve oauth2...
Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: oauth2.service: main process exited, code=exited, status=216/GROUP
Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Unit oauth2.service entered failed state.
Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: oauth2.service failed.
`

Also, this requires that PMSF is installed in /var/www/html/PMSF as per the oauth2 service env path.

Also var/www/html/PMSF/oauth2/env/ didn't get created till after running 7. pip3 install -r requirements.txt yet the service is asked to be started in step 3.

@tallypokemap
Copy link
Author

I updated the order of the steps which hopefully is a better order. Also, I meant to replace the /var/www/html/PMSF with PATH/TO/PMSF but I never could get it to work anywhere else but that folder. Maybe someone better understanding permissions can figure out how to make it work elsewhere. Two places to look for error messages are in /var/log/nginx/error.log and also by running the command sudo journalctl -u oauth2. Lastly what doe the console say when you run this command:
/var/www/html/PMSF/oauth2/env/bin/gunicorn --workers 3 --bind unix:oauth2.sock -m 007 wsgi:app

@ARGG1
Copy link

ARGG1 commented Aug 20, 2017

https://pastebin.com/HdxiTWTY

ModuleNotFoundError: No module named 'wsgi'

Running on centos7. Already have installed mod_wsgi

@hokiepokedad
Copy link
Contributor

@tallypokemap I haven't run the code yet but there's a circular reference in bot.py and oauth2.py.

@wateredstorm
Copy link

Howdy, can't get it run tho to this error:
root:/var/www/PMSF/oauth2# python3 bot.py
Traceback (most recent call last):
File "bot.py", line 8, in
from oauth2 import get_path, get_args
File "/var/www/PMSF/oauth2/oauth2.py", line 12, in
from bot import Bot, get_path
File "/var/www/PMSF/oauth2/bot.py", line 8, in
from oauth2 import get_path, get_args
ImportError: cannot import name 'get_path'
Thanks for the PR wish i can get it to work :P

@tokar86a
Copy link

tokar86a commented Oct 9, 2017

@tallypokemap Have you stop working on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants