Facebook Graph API add extra parameter to login url - facebook-graph-api

is there any way to get back my users to the current page after they login and redirect to my callback url? for example my current page url is:
https://mydomain.test/post1
then my callback url is:
https:/mydomain.test/callback.php
I tried to add extra parameter to login url but got an error because of the Valid OAuth Redirect URIs url match. my url is dynamic so I need a way to set parameters that changes and start from there.

Related

Django redirection after successful login

Is it possible that after successful login first redirect to a new page and not to that url witch is in the next parameter (ex. http://localhost:8000/ro/login/?next=/ro/exam/3/). So what I exactly want is after a successful login first redirect to that url what I provided in LOGIN_REDIRECT_URL, and also I want to keep somehow the next url ( http://localhost:8000/ro/login/?next=/ro/exam/3/), because after the user clicks somewhere I want to redirect him to the target.
Ciao, why don't you redirect the user in LOGIN_REDIRECT_URL on login button click, and then on another user action send him to ( http://localhost:8000/ro/login/?next=/ro/exam/3/) (stored somewhere as a string) ?

django response redirect with parameters site suffix becomes null during Delete

I display list of details in id = 3 in this page using this url
http://192.168.1.16:8000/property/info/7/3/
If i click on delete button functionality works good but Error during
Redirecting to same URL
only this part of url gets display in address bar. /property/info/7/
return HttpResponseRedirect(reverse('property_info',args=[prop_id,7]))
I had used site suffix for url

Accessing URL in 'get' method of view

I want a web page (with the url page3) to be displayed differently depending on whether a user on my website is redirected to it from the pages with urls page1 or page2.
How can I access the full url (not just the query parametres in it) from which the user was redirected in the get method in the view associated with the url page3 ?
After reading the docs more thoroughly (thanks for the tip Brandon!), I found request.META['HTTP_REFERER'] did the trick.

Django. How to redirect to url with fragment identifier

For example in some cases after POST or GET request I want to redirect user not only to specific page, but to a specific part of page. What would be better: implement this in Django(reconstruct redirect url?) or implement this in javascript?
Why would you want to do it in JS? If you're redirecting to a different page already, just add #whatever to the redirect URL to go direct to the anchor.

How to redirect to page which has GET parameters after login using the {{next}} variable in django

I am using allauth to provide registration and login in my django site. Everything else seems to be working fine other than that I am having problems to redirect the person to the current page after login.
I have a page where I have some interview questions and a typical url for it would be like
/questions/?company=google
This page contains a list of questions for the company google, but to view the answer the person needs to login. The answers are displayed in a dropdown box. However when the user clicks on login a request is sent to the login page as follows
/login/?next=/questions/
And the get parameter which was actually there in my actual page is not sent because of the & in my url. How can I solve this problem. It does not look nice that the person is redirected to a different page from where he/she tried to login.
I know sending the next parameter as a GET variable is not the solution, but is there a way I can send the redirect link as a POST variable from the template.
I tried another thing, in my view that displays the questions list. I set session variables which contains the url of the current link . If a user clicks on login, in my login view I check for this particular session variable. If it is set then I redirect to that page.
However the session variable is not received in the login view, I am not sure but I think the session is reset when the user goes to the login view.
Any suggestions are appreciated.
Have you tried
next = request.get_full_path()
This will return correct path with all queries ( see docs ) , you can then pass it as GET param to redirect url e.g.
full_path = request.get_full_path()
return HttpResponseRedirect('%s?next=%s' % (reverse('login'), full_path))
You should encode the URL-parameter in this case. You want to send a variable like /questions/?company=google, but as you mentioned the ?, = (amongst others) characters are special ones. It has a special meaning when embedded in the URL. If you encode the variable with URL encoding, it becomes %2Fquestions%2F%3Fcompany%3Dgoogle. If you assign that to the parameter next, the URL becomes: /login/?next=%2Fquestions%2F%3Fcompany%3Dgoogle. This should redirect to the correct place on login.