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

OAuth2Session ignores self.state when generation an authorization url #57

Closed
FelixSchwarz opened this issue Jun 18, 2013 · 3 comments
Closed

Comments

@FelixSchwarz
Copy link

OAuth2Session always calls self.new_state() in authorization_url even if the user specified a state in the constructor. I think that should be changed.

As a side note I think the state and state_generator arguments should be mutually exclusive to prevent errors on the user side.

@ib-lundgren
Copy link
Member

I agree. A way both could be achieved would be to combine the state and state_generator arguments to one, state and document that it can be a callable or string, then check for TypeError. The overloaded use of self.state would need to change so to internally track the actually used state instead use self._state.

def new_state():
    try:
        self._state = self.state()
    except TypeError:
        self._state = state

@FelixSchwarz fancy making those changes and sending a PR? Don't worry if you don't have time, I can find some soonish.

@FelixSchwarz
Copy link
Author

Am 18.06.2013 16:57, schrieb Ib Lundgren:

@FelixSchwarz https://github.com/FelixSchwarz fancy making those changes and
sending a PR? Don't worry if you don't have time, I can find some soonish.

Well currently I have approximately zero free time so I'd be glad if you could
fix it :-) Thank you very much for picking up the issue so quickly.

@ib-lundgren
Copy link
Member

state is no longer ignored and can be either a string or a callable. It should no longer be ignored in new_state =)

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

No branches or pull requests

2 participants