Answer the question
In order to leave comments, you need to log in
Redirect_uri with parameters when using OAuth authorization
Good day to all. I am implementing authorization into the site through VKontakte. Task: to make it so that when you log in from any page of the site, if successful, the same page opens again.
Example: page address http://site.ru/articles?category=1&id=8
When generating a page, I create a link:
Авторизация через ВКонтакте
As a result, when the user clicks on the link and then logs in to the Vkontakte website, he is redirected to the page http://site.ru/articles?category=1&code=8d61a70a2be1d7d8a8
How to redirect to http://site.ru/articles?category=1&id=8&code=8d61a70a2be1d7d8a8
Answer the question
In order to leave comments, you need to log in
Encode your redirect_uri parameters, at least with http_build_query, so that & is %26 instead
Try swapping the redirect_uri and response_type parameters in the authorization link
Well, there seems to be only one way out. You will have to replace the ampersand with %26, and after authorization - back %26 with an ampersand and make another redirect.
Alternatively, in the user's session, always store the last page they opened. Every time a user opens a page, check the session and ref data. If the ref is "VKontakte", then redirect the user to the address stored in the session.
To solve applied problems, it is better to use Python. Simpler, more concise, a billion libraries for solving intermediate problems.
If we talk exclusively about Java vs C #, then there is essentially no difference.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question