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

Is there a way to catch payload and response/visualization of token of a request? #518

Open
Luccanjm opened this issue Jan 27, 2023 · 4 comments

Comments

@Luccanjm
Copy link

I need to take the token that a request return, I didn't find a way, is there a way to this?

@lread
Copy link
Collaborator

lread commented Jan 27, 2023

Hi @Luccanjm, like an oauth token for example?

Although I think some folks have managed to get at tokens when using WebDriver,
from what I understand, the WebDriver philosophy, love it or hate it, seems to be that it is simulating user interactions.

And users would never see a token.

A user would simply login and the browser would handle any tokens for them.

Maybe if you describe your use case more we can figure something out.

@Luccanjm
Copy link
Author

Luccanjm commented Jan 27, 2023

Hi @lread , thanks for reply. I need a authtoken(access-token), when I do login there is a request that returns with response the access-token and firebase-access-token, I need them. I used the function get-requests but it don't return the "response" that I need, just header response. I know webdriver it's not the best way to catch this token, but was my first attempt and I think the easier, so if I could catch this with webdriver would be perfect.

@lread
Copy link
Collaborator

lread commented Jan 27, 2023

@Luccanjm So you need these tokens because you want to use them to make requests outside of your WebDriver browser sessions?

If we come up with something, my feeling is that it will be on the awkward side.
But let's take a stab at it.

Idea 1: If the token location is known, fetch via injected JavaScript

If you know where the token is stored, you can sometimes fetch it via JavaScript.

For example, apparently, Firebase stores its token in an IndexedDB.

WebDriver provides a facility to inject JavaScript which Etaoin exposes like so.
(Yes, I said the WebDriver philosophy is to only allow what a user might do, but I never claimed their philosophy was entirely consistent! 🙂)

So you could inject some JavaScript to return the token.

Idea 2: Login outside of WebDriver

Use regular HTTP requests to login outside a WebDriver session.
Then somehow inject the tokens into your WebDriver session.
This might be awkard in your scenario, you have multiple tokens.

Idea 3: Experiment with snooping on traffic more.

If you are using Chrome, maybe you will be able to see what you need to see.
But maybe not? Maybe you already tried this?

Idea 4: Use the WebDriver session web browser proxy to snoop on traffic

You can setup a proxy and then snoop via that.

I think this one has typically been the Selenium WebDriver team recommendation for this kind of thing.

@Luccanjm
Copy link
Author

I will see those ideas!! Thanks for the tips :)

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