Skip to content

pliroco/sign-in-with-pliro-example

Repository files navigation

Example Sign in with Pliro integration

This repo contains an example integration demonstrating how to sign customers into the website of a fictional newspaper called "The Greenfield Times", and manage access to its content.

You can try the application live at greenfieldtimes.news. The site is using Pliro's test environment which allows you to create a subscription without incurring any costs.

The application is built in Ruby using the minimal Sinatra web framework (similar to Express, Flask, etc.) but we hope that the code will look familiar to developers using other programming languages and frameworks too.

To learn more about to build your integration, checkout the docs on Sign in with Pliro.

Running the app locally

To run this app locally you will need a Pliro test publication. If you don't have one, email [email protected] and I'll help you set one up!

This app also requires Ruby, Bundler, and Redis to run. We recommend using rbenv (or similar) to install Ruby. On macOS you can install rbenv and Redis using Homebrew:

brew install rbenv ruby-build redis
brew services start redis

To set up rbenv, run this and follow the printed instructions:

rbenv init

You can then install Ruby and gem dependencies:

cd sign-in-with-pliro-example
rbenv install -s
gem install bundler
bundle install

The app will also need to be configured to connect with your Pliro publication. Create an OAuth application in the Pliro Dashboard and copy the client ID and secret into the following commands:

echo 'PLIRO_SITE_URL=https://your-publication.plirotest.page' >> .env.local
echo 'PLIRO_CLIENT_ID=your-client-id' >> .env.local
echo 'PLIRO_CLIENT_SECRET=your-client-secret' >> .env.local

You should now be ready to start the server:

ruby server.rb

Now visit http://localhost:4567 in your browser! 🎉

Support

Feel free to reach out to [email protected] if you run into any issues.