Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Auth0 device authorization flow example #155

Closed
wants to merge 2 commits into from

Conversation

schoenenberg
Copy link

@schoenenberg schoenenberg commented Aug 31, 2021

Hi,

thank you for this great library! I have used it to implement a CLI using Auth0. I would like to contribute this example back, because it took me some time to figure out a strange compiler error concerning the request_async method for the oauth2::DeviceAccessTokenRequest.

Best regards,
Max

@Morishiri
Copy link

OMG. thank you very much for this!

Turns out the missing point to the one which already exists in the docs: https://docs.rs/oauth2/latest/oauth2/#device-code-flow

is

    .set_auth_type(AuthType::RequestBody);

@michaeljones
Copy link

Thank you for the this example. It is very helpful.

examples/auth0_async_devicecode.rs Outdated Show resolved Hide resolved
Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
@schoenenberg
Copy link
Author

Thanks @aminya! I don't know if this will ever be merged. But as long as it is helpful also in the PRs I will leave it here.

@aminya
Copy link

aminya commented Feb 26, 2024

@ramosbugs I find this example very useful. Would you please consider merging it?

@ramosbugs
Copy link
Owner

@ramosbugs I find this example very useful. Would you please consider merging it?

I'm trying to weigh the value of individual examples against the maintenance cost associated with them. I'm currently introducing some breaking changes to the next major release (e.g., #135, #236, #253), and updating all 9 current examples has been a pain.

The intent of this crate's examples is to illustrate how to use different features of this crate. Providing copy-pasteable working production code for every auth vendor is not a goal (though I would consider making exceptions for sponsors who help fund the maintenance of this project). That's the purview of vendor documentation/sample code, blog posts, etc. I'm willing to link to separately-maintained contributed examples, which don't introduce maintenance load to this crate (other than link rot).

The specific features used by this example are:

Given that there are no new features illustrated by this example, I don't think it meets the criteria for adding a new example. It's reasonable to expect paying users of Auth0 who want to use this crate to read the documentation provided by Auth0 and the documentation provided by this crate and figure out how to use the two together. If an Auth0 user wants to publish a blog post or contribute an external example to help other Auth0 users, that would be great. However, it's unreasonable to expect unfunded libraries that implement standardized protocols to become comprehensive resources for interacting with every other entity that implements the same protocol.

@aminya
Copy link

aminya commented Feb 27, 2024

That's fair. I was thinking of creating micro packages to handle common workflows like this. We can have a crate like auth0, and have the supported flows in separate functions e.g. (auth0::device_authotization_flow).

Actually, all the URLs of this example that are separate environment variables can be calculated using the Auth0 domain. So the code can become even simpler.

@ramosbugs
Copy link
Owner

Vendor-specific packages built on top of this one (or openidconnect) sound good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants