Codeigniter, Facebook and Facebook's login "code" query variable -
we're trying log users our codeigniter app php sdk, we're using segmented uris , have no need query strings we've opted not use them. 1 of problems seems ci , facebook passing redirect_uri
parameter getloginurl()
e.x.
public function login(){ if(!$this->user){ $this->data['loginurl'] = $this->facebook->getloginurl(array( 'redirect_uri' => 'http://appdomain.com/users/login' )); $this->load->view('users/login', $this->data); }else{ redirect('home/index'); } }
after logging facebook, uri returned has code
query variable ci doesn't like, breaks routing , displays blank page.
http://appdomain.com/users/login/?code=dsfeoilkjd983274893hflksdfhhewhkdsiue8...
even if add $route['users/login/(:any)'] = 'users/login';
routes.php
, i'm still redirected blank page. since using getaccesstoken()
make api calls on user's behalf, don't need use code
query var exchange access token. possible remove query string completely, possibly in my_controller
, before routing method/action
?
the way able bypass problem passing default controller redirect_uri
parameter, else won't route correct uri , displays blank page.
any suggestions appreciated!
you can remove query string .htaccess
. not sure if work, should if function actual redirect i.e. login process sending user http://appdomain.com/users/login/?code=dsfeoilkjd983274893hflksdfhhewhkdsiue8...
seems case.
this .htaccess
(in addition removing index.php
) strip query string , send url http://appdomain.com/users/login/?code=dsfeoilkjd983274893
http://appdomain.com/users/login/
:
rewritecond $1 !^(index\.php|images|robots\.txt) rewriterule ^(.*)$ /index.php/$1 rewritecond %{query_string} !="" rewriterule ^(.*)$ $1? [r,l]
the r
on last line seemingly optional. if leave out, url still display querystring in url, won't parsed. if leave in, not display querystring in url.
Thanks for sharing this valuable information with us keep Blogging !!
ReplyDeleteDigital Marketing agency in Vizag
Seo Services in Vizag
Web Designing companies in Vizag
Best Website Designers in Vizag
Web Designing Services in Visakhapatnam