Coder Social home page Coder Social logo

aritrakrbasu / github-authentication-backend Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11.48 MB

A simple flask server that helps frontend (client) to very github OAuth access token

Home Page: https://github-authentication-backend.onrender.com/github/callback

Python 99.79% JavaScript 0.03% PowerShell 0.18% Batchfile 0.01%
authentication authentication-backend github-api github-authentication github-authentication-api github-authentication-from-client authentication-backends

github-authentication-backend's Introduction

GitHub Authentication Backend

Introduction

This project is an API server based on FastAPI (python), designed to facilitate the exchange of GitHub code for an access token. It provides a straightforward means for integrating GitHub authentication into your Python applications, allowing users to securely authenticate via GitHub OAuth.

Features

  • FastAPI Backend: Utilizes FastAPI, a modern, fast (high-performance), web framework for building APIs with Python.
  • Secure Token Exchange: Exchange GitHub code for access tokens securely.
  • RESTful API: Provides a clean and easy-to-use RESTful API for authentication purposes.

How To use

GET /github/callback?ci=<client_id>&cs=<client_secret>&ruri=<redirect_uri>&code=<code>

Params

Key Description
cs client_secret
ci client_id
ruri redirect_uri
code code

Responses

All the types of response that you will get if you call the api

Success

{
   "status": "200",
   "msg": "Success",
   "access_token": "token"
}

Error

{
   "status": "400",
   "msg": "Missing code",
   "key_missing":"code"
}

For Self Installation

Setup

  1. Clone the repository:

    git clone https://github.com/aritrakrbasu/github-authentication-backend.git
  2. Navigate into the project directory:

    cd github-authentication-backend
  3. Install dependencies:

    pip install -r requirements.txt

Start your development server

  1. Start the server:

    uvicorn main:app --reload
  2. Make requests to the API endpoints as needed.

API Endpoints

GET /github/callback?ci=<client_id>&cs=<client_secret>&ruri=<redirect_uri>&code=<code>

Exchanges GitHub code for an access token.

Apologies for the oversight. Here's the corrected markdown file for the README:

markdown Copy code

GitHub Authentication Backend

Introduction

This project is an API server based on FastAPI, designed to facilitate the exchange of GitHub code for an access token. It provides a straightforward means for integrating GitHub authentication into your Python applications, allowing users to securely authenticate via GitHub OAuth.

Features

  • FastAPI Backend: Utilizes FastAPI, a modern, fast (high-performance), web framework for building APIs with Python.
  • OAuth Integration: Seamlessly integrate GitHub authentication into your applications.
  • Secure Token Exchange: Exchange GitHub code for access tokens securely.
  • RESTful API: Provides a clean and easy-to-use RESTful API for authentication purposes.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/github-authentication-backend.git
  2. Navigate into the project directory:

    cd github-authentication-backend
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    Create a .env file in the root directory and add the following:

    GITHUB_CLIENT_ID=your-github-client-id
    GITHUB_CLIENT_SECRET=your-github-client-secret
    

    Replace your-github-client-id and your-github-client-secret with your GitHub OAuth application's client ID and client secret respectively.

Usage

  1. Start the server:

    uvicorn main:app --reload
  2. Make requests to the API endpoints as needed.

API Endpoints

POST /auth/github/exchange

Exchanges GitHub code for an access token.

Contributing

Contributions are welcome! Feel free to open issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

Thanks to GitHub for providing OAuth authentication services. This project was inspired by the need for a simple and secure way to authenticate users via GitHub in various client side applications.

github-authentication-backend's People

Contributors

aritra-basu-clirnet avatar aritrakrbasu 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.