GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - authlib/example-oidc-server: Example for OpenID Connect 1.0 Server for Authlib.

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
website
website
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
app.py
app.py
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Example of OpenID Connect 1.0 Provider

This is an example of OpenID Connect 1.0 server in Flask and Authlib.

  • Documentation: https://docs.authlib.org/en/latest/flask/2/
  • Authlib Repo: https://github.com/lepture/authlib

Take a quick look

This is a ready to run example, let's take a quick experience at first. To run the example, we need to install all the dependencies:

$ pip install -r requirements.txt

Set Flask and Authlib environment variables:

# disable check https (DO NOT SET THIS IN PRODUCTION)
$ export AUTHLIB_INSECURE_TRANSPORT=1

Create Database and run the development server:

$ flask initdb
$ flask run

Now, you can open your browser with http://127.0.0.1:5000/, login with any name you want.

Before testing, we need to create a client:

create a client

NOTE: YOU MUST ADD openid SCOPE IN YOUR CLIENT

Let's take authorization_code grant type as an example. Visit:

http://127.0.0.1:5000/oauth/authorize?client_id=${CLIENT_ID}&scope=openid+profile&response_type=code&nonce=abc

After that, you will be redirect to a URL. For instance:

https://example.com/?code=RSv6j745Ri0DhBSvi2RQu5JKpIVvLm8SFd5ObjOZZSijohe0

Copy the code value, use curl to get the access token:

curl -u "${CLIENT_ID}:${CLIENT_SECRET}" -XPOST http://127.0.0.1:5000/oauth/token -F grant_type=authorization_code -F code=RSv6j745Ri0DhBSvi2RQu5JKpIVvLm8SFd5ObjOZZSijohe0

Now you can access the userinfo endpoint:

$ curl -H "Authorization: Bearer ${access_token}" http://127.0.0.1:5000/oauth/userinfo

About

Example for OpenID Connect 1.0 Server for Authlib.

authlib.org/

Resources

Readme

Security policy

Security policy
Activity
Custom properties

Stars

65 stars

Watchers

1 watching

Forks

36 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.