#oauth #oauth2 #google-service #google-api #google #http-request #document

yup-oauth2

An oauth2 implementation, providing the 'device', 'service account' and 'installed' authorization flows

95 releases (56 stable)

11.0.0 Jun 27, 2024
10.0.1 Jun 10, 2024
9.0.0 Apr 23, 2024
8.4.0 Apr 23, 2024
0.3.1 Mar 22, 2015

#2428 in Network programming

Download history 47774/week @ 2024-07-20 48436/week @ 2024-07-27 53923/week @ 2024-08-03 62240/week @ 2024-08-10 59742/week @ 2024-08-17 71249/week @ 2024-08-24 60978/week @ 2024-08-31 67215/week @ 2024-09-07 60220/week @ 2024-09-14 66419/week @ 2024-09-21 69987/week @ 2024-09-28 54436/week @ 2024-10-05 76454/week @ 2024-10-12 77703/week @ 2024-10-19 59494/week @ 2024-10-26 54159/week @ 2024-11-02

278,143 downloads per month
Used in 780 crates (731 directly)

MIT/Apache

160KB
3K SLoC

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

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.

Dependencies

~18–37MB
~777K SLoC