0

I am running a UI test on the webpage that uses google oauth2 for login (Gmail address as username). My problem is that I need to login with multiple different users during the same test, but after the first logout, pressing login again automatically logs in the previous user. Does not happen when I manually try to login/logout.

I'm assuming this is because during test run auth token is still active and google logs in automatically.

Things I have tried so far:

1) - importing google-auth-library and run GoogleAuth.disconnect() -> returns error: disconnect is not a function.

2) - How to reset google oauth 2.0 authorization? - import 'googleapis' and run gapi.auth.setToken(null) - gapi.auth has no such option.

Can't try revokeAccess functions suggested since I don't know the token value.

Is there a way for me to retrieve login token from my test (I'm guessing it would be from client side) so that I could set it to null/delete it?

fool-dev
  • 7,671
  • 9
  • 40
  • 54
Wocha
  • 33
  • 7
  • 1
    Are you sure it's the token and not a cookie? You can try clearing all the browser cookies and see if that helps. – tehbeardedone Jan 09 '18 at 14:20
  • Also, there is this https://github.com/google/google-auth-library-nodejs#retrieve-access-token. You said you don't know the value of the token but that code snippet shows you how to get it. – tehbeardedone Jan 09 '18 at 14:24
  • @tehbeardedone, Yes i am sure. I cleared cookies and it did not work. I have read the github link you provided. Unfortunately i don't have access to auth request/response from my UI tests. Since posting this question i have done some more reading and think the issue might be in auth request params, missing approval_prompt="force" or prompt="select_account". I will give an update once params are set. – Wocha Jan 10 '18 at 13:38

0 Answers0