T
T
Taylor_Superhero2016-04-08 12:55:11
Parsing
Taylor_Superhero, 2016-04-08 12:55:11

How to parse the url of a page that my code doesn't know about?

To access vkapi from a standalone application, I direct the browser to the link specified in the vk documentation. The client follows it, passes authorization and its access_token appears in the url. It remains only to parse it using url.parse("current page url").hash . But how to tell the code which url to parse if this url has just been generated and is generally in a new window, on a page that my application does not know about? The line looks like this " http://REDIRECT_URI#access_token= 533bacf01e11f55b536a565b57531ad114461ae8736d6506a3&expires_in=86400&user_id=8492" What is the way to use to return this url in my code?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2016-04-08
@Taylor_Superhero

There is no way to parse this, it is a protection so that only STANDALONE applications can use it. They will have no problem accessing this address.
And regular browser applications cannot get the token automatically.

A
Alexey Cherepanov, 2016-04-08
@Udjine

If you need a token, then find out the entry point "=" in the string and cut off your token with a substring. I do not see the complexity of the task. You can accept the token as a url parameter, for example. Or take the whole url as a parameter, if necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question