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

Feature request: Custom OAuth state #267

Open
anderspitman opened this issue Dec 12, 2024 · 2 comments
Open

Feature request: Custom OAuth state #267

anderspitman opened this issue Dec 12, 2024 · 2 comments

Comments

@anderspitman
Copy link

anderspitman commented Dec 12, 2024

I need to store some extra information alongside the InternalStateData. In order to do this I need access to the oauth state in order to store/retrieve my data. I see two ways this could be implemented:

  1. Allow the state parameter to be overridden. This would be a very small change, as it appears the API is already set up for this. This should not break the current API. I would be happy to submit a PR for this.
  2. Instead of returning a String from client.authorize(), return a struct that contains the redirect URI and the internally generated state. This might be a more robust solution, but would also break the current API.

Are you open to this functionality?

@sugyan
Copy link
Owner

sugyan commented Dec 13, 2024

I don't understand in what context and what kind of data you want to keep, but I believe that the oauth-client stores/retrieves only the data necessary for authentication, and the user data is stored by the application implementer themself.

The official TypeScript SDK for atproto allows the user to specify a state when calling authorize() and returns the value of that state upon successful callback.
https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client#authentication
I plan to implement that functionality in ATrium as well, but wouldn't using that state value to store data in the application implementer's own store be a solution?

@anderspitman
Copy link
Author

Sorry if I was confusing. I just need exactly the functionality the official SDK provides. If you implement that I should be good to go. In fact I can submit a PR if you'd like.

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 a pull request may close this issue.

2 participants