Laravel 5 Socialite - Redirect Paramaters - php

Does anyone know of a way to have redirect variables persist while a user is logging in via Facebook or Google. This has puzzled me for a while now.
For example if I want to redirect the user back to a specific article (page) on the website I need the URI information to persist during the login.
The problem is that the login process takes the user to the provider (in my case Facebook or Google) and then back to the website. During which time the redirect information is lost.
Does anyone know of a way to do this?
All help is appreciated.
Thanks,
cs1h

Related

Multiple domain user login access control in drupal7

E.g. My site has two subdomains : first_domain and second_domain.
And My site has three roles:admin, site-manager, editor.
I hope:
User with admin can login first_domain, can't login second_domain. (When user visit second_domain user status is not logined and not lost first_domain logined status)
User with site-manager can login second_domain, can't login first_domain.
User with editor can login first_domain and second_domain.
Does anyone have any solution?
Take a look at this module, i think it would help you, you might have to twist a configuration based on requirement but could be good base module.
https://www.drupal.org/project/domain_roles
You need to manage session in every domain and check that if one user is login in first domain and session is created then the second user redirects to a page where it say already login.
I cannot write a code here for you for making sessions. You can create session in php.
Let me know if you are not able to understand the logic.

Is it possible to ask for the Facebook login credentials only once and then save them and login without entering them again?

I would like to create a PHP/MySQL application where the owner of the application can add multiple Facebook accounts and use them to post on one or more pages.
After reading the Facebook Login API docs I understand that the only way to login a user is to generate the login URL and then enter the username and password in the generated page. This is ok, if you do it once, but it will be a pain in the ass to do it every time you want to post something form multiple accounts (by multiple I mean more than 50).
So here's my question: is it possible to ask for the credentials only once, store them some in the database and then just login by pressing a button? No popups, no nothing?
P.S. I know for sure its possible because I've seen this behavior in a desktop app.
Thank you!

Redirect authentication via OAuth2 to Google login page

I created a web app that allows users to connect their google calendar using OAuth2. And so far everything is working the way I've wanted it to be. Now my concern is, when a user clicks the link to authenticate his account, I want it to forcefully redirect to the google login page. Right now, when he clicks the link and his google account has an on-going session in that specific browser, the login page no longer appears. Is there a way to do that? Thanks.
If you set the parameter approval_prompt to force, you should be able to forcefully show the auth screen every time. More details about this parameter are documented here.
the only way to do that is to force a full logout from that client (browser, app, etc). You can do that by using:
https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue= and add the redirect as "continue" parameter.
This will logout from everywhere so the user might not be happy if he/she didn't do that on purpose.
I would go with asking for permissions again if you want to make the users "feel" like they are actually login into your app again (i assume that why you want this approach).
Google also has a "switch user" option, but I haven't use it and it's really hard to know if the user will be asked for user and pass or the user will be automatically authenticated because he/she is already logged in another tab in the browser.

posting to Facebook page wall as page itself with no user session

This is my first question here, so apologies if asking something trivial - though I didn't find an answer after an hour of digging.
I have a PHP website which needs to connect with a Facebook page in the following method:
On certain triggers, the site needs to post to the page's wall as the page itself. This has to be done automatically, even if no user session is available (e.g. if someone uses the site without actually having a Facebook account).
I found solutions using extended token expiration times (offline access), but in those cases, the post will always appear as the site admin (me, in this case). However, I need the post to be written by the page. When using Facebook as the page, I have no right to request an offline access token.
Is this even possible at the moment?
You need to cache the page access token on your server and use that to make the updates - the page login is pretty well documented here: https://developers.facebook.com/docs/authentication/pages/ -
Store the access_token in your server-side code and use that token to post as the page - the page access token won't expire if you have a long-expiry access token for the page admin, unless the user stops being an admin of the page, removes the app, etc.

Facebook Sharer and page Authentication

The website I am developing requires authentication before you can access anything, but I want to allow users to share information with facebook once they have logged in. When I use the standard facebook sharer.php link it pulls up the data from the login page, not the page with the data the user would want to share.
http://www.facebook.com/sharer.php?u=<url to share>&t=<title of content>
Is there any way to allow Facebook to see the data behind the authentication?
I found a temporary work around:
[http://forum.developers.facebook.net/viewtopic.php?pid=178614]
In the last post on this page the user talks about how he used static pages with redirects so that the facebook sharer would find the proper data, and the user would be redirected to the page they expected. Doesn't seem to be the best way, but it works for now.

Categories