Skip to content
An OAuth server application that handles incoming OAuth requests for Lichess.
Branch: master
Clone or download
Pull request Compare This branch is 25 commits ahead of chesszebra:master.
Latest commit a2d3973 Dec 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Initial commit. Jan 28, 2018
config Fixed a typo, referrer is with double R Feb 14, 2018
data Hooked up Monolog to log all PHP errors. Feb 6, 2018
public
src/App
templates
test/AppTest/Action Initial commit. Jan 28, 2018
.gitignore Removed the demo client Jan 29, 2018
LICENSE
README.md fix readme typo Feb 4, 2018
composer.json
composer.lock Set the version of monogdb to 1.0.* Feb 6, 2018
docker-compose.yml Disabled the nginx container since it doesn't work yet Feb 6, 2018
phpcs.xml.dist Initial commit. Jan 28, 2018
phpunit.xml.dist Initial commit. Jan 28, 2018

README.md

lichess-oauth-server

An OAuth server application that handles incoming OAuth requests for Lichess.

Installation

All commands are meant to be ran from the root of your project directory.

Clone the repository to your favourite destination path.

git clone https://github.com/chesszebra/lichess-oauth-server.git

From here choose your preferred way of working.

Docker

Install the PHP dependencies via Docker:

docker run --rm -it -v $(pwd):/data chesszebra/composer:7.0 install

The OAuth server requires a public and private key, let's create them:

openssl genrsa -out data/private.key 2048
openssl rsa -in data/private.key -pubout -out data/public.key

We also need an encryption key, let's create it:

docker run --rm -it -v $(pwd):/data chesszebra/php:7.0-cli -r 'echo base64_encode(random_bytes(32)), PHP_EOL;'

Configuration

Enter the correct values inside the configuration files we are about to create now. The configuration files should be self explanatory.

Create the local configuration file used to run the application:

cp config/autoload/local.php.dist config/autoload/local.php

Cache

NOTE: It could be that a config cache is created, make sure to remove data/config-cache.php in order for the config to be reloaded.

Database

Depending on your preferred storage system, either enable the PDO or MongoDB dependencies. Also enter the correct database information.

Templates

If you want to override the HTML template, create a new Twig template templates/app/oauth-authorize-custom.html.twig. For an example, have a look at templates/app/oauth-authorize.html.twig. If the custom template does not exists, the application will automatically fallback to templates/app/oauth-authorize.html.twig.

Development

If you are developing the application, it might be wise to enable the development configuration files. This will make development easier.

cp config/development.config.php.dist config/development.config.php
cp config/autoload/development.local.php.dist config/autoload/development.local.php

Demo Client

One could create a file public/demo-client.php or simply copy examples/demo-client.php to test the server.

You can’t perform that action at this time.