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

badtoken #8

Closed
josve05a opened this Issue Mar 31, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@josve05a
Contributor

josve05a commented Mar 31, 2014

image
It did not edit anything. I updated the page, and then it worked.

@theopolisme

This comment has been minimized.

Contributor

theopolisme commented Apr 1, 2014

This happens when the page is opened and then there is a loss of session data (e.g. the computer goes to sleep or is inactive for a long time, or like Anne said, a network switch between when you loaded the page -- and we first fetched the edit token, required to save the page -- and when we actually tried to save), which results in the token MediaWiki provides becoming out of date. I'll work on some sort of mechanism for automatically recovering from these errors, probably this weekend (quite busy during the week)... (cross posted on-wiki)

@Technical-13

This comment has been minimized.

Technical-13 commented Apr 1, 2014

Why not just wait to retrieve the token until just before the save?

@theopolisme

This comment has been minimized.

Contributor

theopolisme commented Apr 1, 2014

We're using mw.user.options, which is only populated on load iirc. Prove me wrong though if you can, that would be helpful!

@legoktm

This comment has been minimized.

Member

legoktm commented Apr 3, 2014

You should be able to use mw.Api().postWithToken which IIRC automatically fetches a new token if you get a badtoken error.

@theopolisme

This comment has been minimized.

Contributor

theopolisme commented Apr 3, 2014

Cool, that looks like with will work. Thanks! I'll be implementing this fix over the weekend, @josve05a.

theopolisme added a commit that referenced this issue Apr 5, 2014

Use postWithToken() method which automatically gets a new token if th…
…e current one is invalid

Should help alleviate (in fact, completely remove) badtoken errors as
discussed in #8.
@theopolisme

This comment has been minimized.

Contributor

theopolisme commented Apr 5, 2014

Now available on enwiki, thanks everyone!

@theopolisme theopolisme closed this Apr 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment