https://github.com/toolforge/my-first-flask-oauth-tool
Mirror of https://phabricator.wikimedia.org/source/tool-my-first-flask-oauth-tool/
https://github.com/toolforge/my-first-flask-oauth-tool
mirror toolforge tutorial
Last synced: 3 months ago
JSON representation
Mirror of https://phabricator.wikimedia.org/source/tool-my-first-flask-oauth-tool/
- Host: GitHub
- URL: https://github.com/toolforge/my-first-flask-oauth-tool
- Owner: toolforge
- License: gpl-3.0
- Created: 2017-10-28T22:45:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-09T22:08:36.000Z (almost 6 years ago)
- Last Synced: 2025-03-06T11:38:09.374Z (about 1 year ago)
- Topics: mirror, toolforge, tutorial
- Language: HTML
- Homepage: https://wikitech.wikimedia.org/wiki/Help:Toolforge/My_first_Flask_OAuth_tool
- Size: 25.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
My first Flask OAuth tool
=========================
This git repository contains the source code for a basic Python webservice
built using the Flask framework. It shows how to use the `mwoath` library to
manage OAuth authentication with a MediaWiki server.
Deploy on Toolforge
-------------------
See https://wikitech.wikimedia.org/wiki/Help:Toolforge/My_first_Flask_OAuth_tool
for a detailed tutorial describing the full process of creating a tool account
and running this tool.
```
$ ssh login.toolforge.org
$ become $TOOL_NAME
$ cat > $HOME/service.template << EOF
backend: kubernetes
type: python3.7
canonical: true
EOF
$ mkdir -p $HOME/www/python
$ git clone https://phabricator.wikimedia.org/source/tool-my-first-flask-oauth-tool.git \
$HOME/www/python/src
$ touch $HOME/www/python/src/config.yaml
$ chmod u=rw,go= $HOME/www/python/src/config.yaml
$ cat > $HOME/www/python/src/config.yaml << EOF
SESSION_COOKIE_PATH: /$TOOL_NAME
SECRET_KEY: $(python -c "import os; print repr(os.urandom(24))")
CONSUMER_KEY: $KEY_YOU_GOT_FROM_OAUTH_REGISTRATION
CONSUMER_SECRET: $SECRET_YOU_GOT_FROM_OAUTH_REGISTRATION
EOF
$ webservice shell
$ python3 -m venv $HOME/www/python/venv
$ source $HOME/www/python/venv/bin/activate
$ pip install --upgrade pip
$ pip install -r $HOME/www/python/src/requirements.txt
$ exit
$ webservice start
```
License
-------
[GNU GPLv3+](//www.gnu.org/copyleft/gpl.html "GNU GPLv3+")