Giter Club home page Giter Club logo

ory-hydra-example's Introduction

Ory Hydra Sample Implementation

Overview

This repo contains two Laravel projects:

  1. server-app: This project contains the logic for Login, Consent, and Logout UIs for use with the Ory Hydra server.
  2. client-app: This project contains a sample OAuth2 client application to test the authentication.

Besides these, you also need the ory hydra from Ory Hydra's Github
See Ory Hydra 5-min tutorial for reference.

In order to test this, you must:

  1. Start the server-app to listen on port 8000
  2. Edit the ory hydra quickstart sample quickstart.yml file and change the port for self.consent, self.login, and self.logout from original 3000 to 8000 to match the server-app.
  3. Start the ory hydra docker containers by running docker-compose up --build -d from the ory hydra folder.
  4. Register a new client with ory hydra by running
    docker-compose -f quickstart.yml exec hydra hydra clients create --endpoint http://127.0.0.1:4445/ --id 8dJoZn1rY3oIH5R1Aau5aYl7TpuPTAVT --secret 49qkTWr7FmjQwAeaRkCuVz8aNXx4iRd1 -g client_credentials,authorization_code -c http://127.0.0.1:8001/login -a openid,offline
    
    This is telling ory hydra to register a client with the following specifications:
    client id: 8dJoZn1rY3oIH5R1Aau5aYl7TpuPTAVT
    client secret: 49qkTWr7FmjQwAeaRkCuVz8aNXx4iRd1
    redirect url: http://127.0.0.1:8001/login
    requested scopes: openid, offline
    
    http://127.0.0.1:4445/ is the ory hydra admin API endpoint. Now edit the client-app .env file and add the following environtment variable values:
    OAUTH2_CLIENT_ID=<client id>
    OAUTH2_CLIENT_SECRET=<client secret>
    OAUTH2_ISSUER_URL=http://127.0.0.1:4444 #ory hydra public api endpoint OAUTH2_AUTHORIZE_URL=http://127.0.0.1:4444/oauth2/auth
    OAUTH2_ACCESS_TOKEN_URL=http://127.0.0.1:4444/oauth2/token
    OAUTH2_RESOURCE_URL=http://127.0.0.1:8000/resource #doesn't exist yet. placeholder for future
    OAUTH2_LOGOUT_URL=http://127.0.0.1:4444/oauth2/sessions/logout
  5. Start the client-app to listen on port 8001
  6. Start the browser and go to http://127.0.0.1:8001/login Enter same value in username and password fields to simulate a successful login attempt.

ory-hydra-example's People

Contributors

lalanikarim avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.