wolfgang1983 Senior Member
Posts: 627
Threads: 271
Joined: Oct 2014
Reputation:
7
05-25-2017, 11:23 PM
(This post was last modified: 05-26-2017, 02:08 PM by wolfgang1983 .)
When a user logins with my google api function and is success full it adds # to the redirected controller url
I don't know how its adding the # hashtag to the redirect url I use vhost
PHP Code:
http : //domain.com/usercp#
Question is there away to stop the hashtag from showing up when user is redirect to there usercp?
PHP Code:
public function google () { $googleplus_auth = $this -> googleplus -> getAuthenticate (); $googleplus_info = $this -> googleplus -> getUserInfo (); $google_data = array( 'google_id' => $googleplus_info [ 'id' ], 'google_name' => $googleplus_info [ 'name' ], 'google_link' => $googleplus_info [ 'link' ], 'image' => $googleplus_info [ 'picture' ], 'email' => $googleplus_info [ 'email' ], 'firstname' => $googleplus_info [ 'given_name' ], 'lastname' => $googleplus_info [ 'family_name' ] ); $login_google_userid = $this -> login_model -> login_with_google ( $googleplus_info [ 'id' ], $google_data ); $_SESSION [ 'user_id' ] = $login_google_userid ; redirect ( 'usercp' ); }
PHP Code:
<?php defined ( 'BASEPATH' ) OR exit( 'No direct script access allowed' ); $config [ 'googleplus' ][ 'application_name' ] = 'Some Name' ; $config [ 'googleplus' ][ 'client_id' ] = '********; // Some id $config[' googleplus '][' client_secret '] = ' ******** '; // Some secret $config[' googleplus '][' redirect_uri '] = ' http : //www.mysetdomain.com/account/login/google'; $config [ 'googleplus' ][ 'api_key' ] = '********' ; // Some api $config [ 'googleplus' ][ 'scopes' ] = array();
I use this google api from here
https://github.com/moemoe89/google-login-ci3
Attached Files
Login.php (Size: 2.95 KB / Downloads: 164)
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
rtenny Member
Posts: 134
Threads: 2
Joined: Jun 2016
Reputation:
3
(05-25-2017, 11:23 PM) wolfgang1983 Wrote: When a user logins with my google api function and is success full it adds # to the redirected controller url
I don't know how its adding the # hashtag to the redirect url I use vhost
PHP Code:
http : //domain.com/usercp#
Question is there away to stop the hashtag from showing up when user is redirect to there usercp?
PHP Code:
public function google () { $googleplus_auth = $this -> googleplus -> getAuthenticate (); $googleplus_info = $this -> googleplus -> getUserInfo (); $google_data = array( 'google_id' => $googleplus_info [ 'id' ], 'google_name' => $googleplus_info [ 'name' ], 'google_link' => $googleplus_info [ 'link' ], 'image' => $googleplus_info [ 'picture' ], 'email' => $googleplus_info [ 'email' ], 'firstname' => $googleplus_info [ 'given_name' ], 'lastname' => $googleplus_info [ 'family_name' ] ); $login_google_userid = $this -> login_model -> login_with_google ( $googleplus_info [ 'id' ], $google_data ); $_SESSION [ 'user_id' ] = $login_google_userid ; redirect ( 'usercp' ); }
I use this google api from here https://github.com/moemoe89/google-login-ci3
I always have a trailing / in the redirect- Not sure, but see that that helps your issue
On the package it said needs Windows 7 or better. So I installed Linux.
wolfgang1983 Senior Member
Posts: 627
Threads: 271
Joined: Oct 2014
Reputation:
7
(05-26-2017, 01:27 AM) rtenny Wrote: (05-25-2017, 11:23 PM) wolfgang1983 Wrote: When a user logins with my google api function and is success full it adds # to the redirected controller url
I don't know how its adding the # hashtag to the redirect url I use vhost
PHP Code:
http : //domain.com/usercp#
Question is there away to stop the hashtag from showing up when user is redirect to there usercp?
PHP Code:
public function google () { $googleplus_auth = $this -> googleplus -> getAuthenticate (); $googleplus_info = $this -> googleplus -> getUserInfo (); $google_data = array( 'google_id' => $googleplus_info [ 'id' ], 'google_name' => $googleplus_info [ 'name' ], 'google_link' => $googleplus_info [ 'link' ], 'image' => $googleplus_info [ 'picture' ], 'email' => $googleplus_info [ 'email' ], 'firstname' => $googleplus_info [ 'given_name' ], 'lastname' => $googleplus_info [ 'family_name' ] ); $login_google_userid = $this -> login_model -> login_with_google ( $googleplus_info [ 'id' ], $google_data ); $_SESSION [ 'user_id' ] = $login_google_userid ; redirect ( 'usercp' ); }
I use this google api from here https://github.com/moemoe89/google-login-ci3
I always have a trailing / in the redirect- Not sure, but see that that helps your issue
Just adds # hashtag after /#
Now very strange not sure why adds hashtag when redirect to usercp
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
InsiteFX Super Moderator
Posts: 6,734
Threads: 345
Joined: Oct 2014
Reputation:
246
05-26-2017, 05:55 AM
(This post was last modified: 05-26-2017, 05:58 AM by InsiteFX .)
He's missing the single ending quote on the below...
PHP Code:
$config [ 'googleplus' ][ 'client_id' ] = '********;
Not sure if that's the full problem.
What did you Try? What did you Get? W hat did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Paradinight Senior Member
Posts: 445
Threads: 6
Joined: Jun 2015
Reputation:
25
PHP Code:
<?php class Test extends MY_Controller { public function __construct () { parent :: __construct (); } public function page1 () { echo '<a href="' . base_url ( 'test/page2' ). '#i_like_cookies">Page 2</a>' ; } public function page2 () { redirect ( 'test/page3' ); } public function page3 () { echo 'look at the url :)' ; } }
@
wolfgang1983 do you need an explain? Some of you links has #
wolfgang1983 Senior Member
Posts: 627
Threads: 271
Joined: Oct 2014
Reputation:
7
(05-26-2017, 05:55 AM) InsiteFX Wrote: He's missing the single ending quote on the below...
PHP Code:
$config [ 'googleplus' ][ 'client_id' ] = '********;
Not sure if that's the full problem.
I put that ******* on here because client id is private. No one else but me is to see it.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
wolfgang1983 Senior Member
Posts: 627
Threads: 271
Joined: Oct 2014
Reputation:
7
(05-26-2017, 09:04 AM) Paradinight Wrote: PHP Code:
<?php class Test extends MY_Controller { public function __construct () { parent :: __construct (); } public function page1 () { echo '<a href="' . base_url ( 'test/page2' ). '#i_like_cookies">Page 2</a>' ; } public function page2 () { redirect ( 'test/page3' ); } public function page3 () { echo 'look at the url :)' ; } }
@wolfgang1983 do you need an explain? Some of you links has #
Its some thing to do with the google api login link once success full it adds # to my
http://www.example.com/usercp # my code is fine.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
wolfgang1983 Senior Member
Posts: 627
Threads: 271
Joined: Oct 2014
Reputation:
7
(05-26-2017, 05:55 AM) InsiteFX Wrote: He's missing the single ending quote on the below...
PHP Code:
$config [ 'googleplus' ][ 'client_id' ] = '********;
Not sure if that's the full problem.
I think I need to some how clean url string before I redirect so it removes # not sure how but will look into it.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Paradinight Senior Member
Posts: 445
Threads: 6
Joined: Jun 2015
Reputation:
25
(05-26-2017, 06:24 PM) wolfgang1983 Wrote: (05-26-2017, 05:55 AM) InsiteFX Wrote: He's missing the single ending quote on the below...
PHP Code:
$config [ 'googleplus' ][ 'client_id' ] = '********;
Not sure if that's the full problem.
I think I need to some how clean url string before I redirect so it removes # not sure how but will look into it.
You use javascript for event handling. You use the link element with a hash as href?
Try on you link event code
https://api.jquery.com/event.preventdefault/