1

I'm working on a chrome extension that will always have a current user who is logged in to GitHub. In order to switch users, I want to have a log out button in my extension that logs the current user out.

I've tried simply

chrome.windows.create({'url':'https://github.com/logout'})

Which takes me to the GitHub logout page but there is still a confirmation that the user would have to click on to successfully logout. I would like to be able to log the user out in the background or at a minimum, without them having to click on an additional confirmation.

Any thoughts?

FajitaNachos
  • 1,000
  • 8
  • 21

2 Answers2

2

You can check if one of the two techniques mentioned here works for you:

Even if the names of the methods differ in the Github confirmation page, the idea remains: if you can somehow override/silence the confirmation method, you can skip past that step.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the answer. I should have been more clear. It's not a confirmation dialog. It's a form on the page with a confirmation button that shows up when you navigate to https://github.com/logout from an external page. I guess I need to figure out a way to submit the form when the window loads. I tried using an XMLHttpRequest to POST to the page but GitHub returned a 422 unproccessable entity error – FajitaNachos Feb 09 '13 at 22:15
  • Your links weren't really relevant (my fault) but they lead me down the right path. Thanks. Upvoted for the help. – FajitaNachos Feb 09 '13 at 22:49
2

Working Solution

When I called https://github.com/logout from an external page it showed a form with a submit/confirm button to logout. The form doesn't have an id or class but I managed to submit it using

 document.getElementsByTagName('form')[1].submit();

Of course, this isn't ideal since it will break if github changes the layout of their logout page. Also, there is a delay between when the page is loaded and the form is submitted which isn't very user friendly. I'll update here if I find a better solution

FajitaNachos
  • 1,000
  • 8
  • 21