MCPcopy Index your code
hub / github.com/dermesser/yup-oauth2

github.com/dermesser/yup-oauth2 @v12.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v12.1.2 ↗ · + Follow
236 symbols 468 edges 26 files 75 documented · 32% updated 5mo ago★ 24226 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build
Status crates.io

yup-oauth2 is a utility library which implements several OAuth 2.0 flows. It's mainly used by google-apis-rs, to authenticate against Google services. (However, you're able to use it with raw HTTP requests as well; the flows are implemented as token sources yielding HTTP Bearer tokens). Note that the newer, asynchronous versions of this crate (version 4) are not compatible with google-apis-rs anymore/at the moment.

To use asynchronous APIs with the new yup-oauth2 (from version 4), use the async-google-apis code generator, which generates asynchronous API stubs for Google APIs and other providers who provide Discovery documents for their REST APIs. (WARNING: that project is still alpha-quality. Contributions are welcome)

The provider we have been testing the code against is also Google. However, the code itself is generic, and any OAuth provider behaving like Google will work as well. If you find one that doesn't, please let us know and/or contribute a fix!

Supported authorization types

  • Device flow (user enters code on authorization page)
  • Installed application flow (user visits URL, copies code to application, application uses code to obtain token). Used for services like GMail, Drive, ...
  • Service account flow: Non-interactive authorization of server-to-server communication based on public key cryptography. Used for services like Cloud Pubsub, Cloud Storage, ...

Versions

  • Version 1.x for Hyper versions below 12
  • Version 2.x for Hyper versions 12 and above
  • Version 3.x for historical interest
  • Version 4.x for tokio 0.2/0.3
  • Version 5.x for tokio 1.0

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

InstalledFlowDelegate (Interface)
InstalledFlowDelegate methods are called when an installed flow needs to ask the application what to do in certain cases [4 …
src/authenticator_delegate.rs
HyperClientBuilder (Interface)
A trait implemented for any hyper_util::client::legacy::Client as well as the DefaultHyperClient. [3 implementers]
src/client.rs
TokenStorage (Interface)
(no doc) [1 implementers]
src/storage.rs
DeviceFlowDelegate (Interface)
DeviceFlowDelegate methods are called when a device flow needs to ask the application what to do in certain cases. [2 …
src/authenticator_delegate.rs
SendRequest (Interface)
(no doc) [1 implementers]
src/client.rs

Core symbols most depended-on inside this repo

token
called by 31
src/types.rs
build
called by 21
src/authenticator.rs
as_str
called by 19
src/error.rs
clone
called by 14
src/storage.rs
request
called by 11
src/client.rs
build_hyper_client
called by 5
src/client.rs
read_service_account_key
called by 5
src/helper.rs
join
called by 5
src/helper.rs

Shape

Method 91
Function 65
Class 60
Enum 15
Interface 5

Languages

Rust100%

Modules by API surface

src/authenticator.rs38 symbols
src/storage.rs27 symbols
tests/tests.rs21 symbols
src/installed.rs20 symbols
src/error.rs15 symbols
src/authenticator_delegate.rs15 symbols
src/service_account.rs14 symbols
src/types.rs13 symbols
src/service_account_impersonator.rs13 symbols
src/client.rs13 symbols
src/helper.rs7 symbols
src/external_account.rs6 symbols

For agents

$ claude mcp add yup-oauth2 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact