-
Notifications
You must be signed in to change notification settings - Fork 9
Support protected resource metadata endpoints #121
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
Comments
Integrated support for this is definitely on my TODO list. BTW, you can already do something like this with the from requests_oauth2client import well_known_uri, oauth2_discovery_document_url, OAuth2Client
resp = util.requests_get(well_known_uri(pds_url, "oauth-protected-resource"))
resp.raise_for_status()
auth_server = resp.json()['authorization_servers'][0]
client = OAuth2Client.from_discovery_endpoint(issuer=auth_server) # using `issuer` kwargs, OAuth2Client will go for an "openid-configuration" well-known uri
# or
client = OAuth2Client.from_discovery_endpoint(oauth2_discovery_document_url(auth_server) # or explicitly provide the full url, with another helper method |
RFC9728 is now released. I have implemented initial support for this, feel free to review the PR. However, looking back at your code above which chooses an authorization server arbitrarily by just picking the first one in the That's why in my current implementation, you need to initialize your client with a trusted AS before you try to initialize your API. I don't know of any real-life scenario where a fully dynamic AS discovery at runtime makes sense anyway, but please feel free to prove me wrong. |
Thanks! Discovery for Bluesky is indeed pretty dynamic, it's a decentralized network, so I won't know all possible ASes ahead of time. Correspondingly, Bluesky OAuth doesn't use
Also, from https://atproto.com/specs/oauth#authorization-servers :
The modern OAuth details here are over my head a bit, I'm sure you understand all this much better than me. I could definitely fail fast if I ever see a Bluesky protected resource endpoint with more than one element in |
Thanks for the insight of Bluesky specifications. I'm not familiar with that at all yet. I'll review that when I have some time and then will think about what can be done to improve support. |
requests_oauth2client
version: headDescription
Hi again! The service I'm building an OAuth client for, Bluesky, uses a protected resource metadata endpoint. That RFC is still just a draft, but it came out of the OAuth working group, and afaik is pretty close to accepted. I'm handling the protected resource endpoint myself, with code below, but eventually it'd be nice if requests_oauth2client supported it natively!
The text was updated successfully, but these errors were encountered: