> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/1.3/pbms/developer-zone/repositories/openg2p-fastapi-common/openg2p-fastapi-auth.md).

# OpenG2P FastAPI Auth

## Introduction

This is a Python package that provides additional support, particularly Authentication and Authorization, to the [OpenG2P FastAPI Common](/1.3/pbms/developer-zone/repositories/openg2p-fastapi-common/openg2p-fastapi-common.md) Library. This page describes different concepts within the library and instructions on how to use it.

## Technical concepts

This package/library contains API Authentication and Authorization helpers for Rest API Services that are bootstrapped by the [OpenG2P FastAPI Common](/1.3/pbms/developer-zone/repositories/openg2p-fastapi-common/openg2p-fastapi-common.md) Library. Details:

<table><thead><tr><th width="184">Name</th><th>Description</th></tr></thead><tbody><tr><td>Login Provider</td><td><ul><li>LoginProvider is an object that helps the user login in the current web app using an external Authorization System.</li><li><p>LoginProviders is a database table where different types of login providers can be configured.</p><ul><li>This module also exposes APIs to query the LoginProviders configured on DB.</li></ul></li><li><p>The <code>type</code> column of LoginProviders can be set to one of the following values.</p><ul><li><code>oauth2_auth_code</code> - If the type is set to this, then the LoginProvider is an OIDC Provider, that supports the basic <code>auth_code</code> flow. (With PKCE being optional)</li></ul></li><li>The <code>authorization_parameters</code> are the parameters required by this LoginProvider</li></ul></td></tr><tr><td>AuthController</td><td>TODO</td></tr><tr><td>OauthController</td><td>TODO</td></tr><tr><td>JwtBearerAuth</td><td>TODO</td></tr><tr><td>ApiAuthSettings</td><td>TODO</td></tr></tbody></table>

## Installation

This section describes instructions for installing the package. Primarily intended for developers using this module.

* Install python3 for your environment.
* Set up a virtualenv in your project directory. Using:

  ```bash
  python3 -n venv .venv
  source .venv/bin/activate
  ```
* Clone [openg2p-fastapi-common](https://github.com/OpenG2P/openg2p-fastapi-common).
* Then Install the common package using pip:

  ```bash
  pip install -e <path-to-cloned-common-repo>/openg2p-fastapi-auth
  ```

## Usage guide

This section describes instructions for using the package/library. Primarily intended for developers using this module to build their own projects.

TODO

### Configuration

TODO

## Source code

* OpenG2P FastAPI Common Module Source Code - <https://github.com/OpenG2P/openg2p-fastapi-common/tree/develop/openg2p-fastapi-auth>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openg2p.org/1.3/pbms/developer-zone/repositories/openg2p-fastapi-common/openg2p-fastapi-auth.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
