philsturgeon / codeigniter-oauth2

NO LONGER ACTIVELY MAINTAINED. USE https://github.com/thephpleague/oauth2-client INSTEAD
http://getsparks.org/packages/oauth2/versions/HEAD/show
352 stars 177 forks source link

Redirect always goes to redirect URI (not the define callback URL) #14

Closed arirasekh closed 11 years ago

arirasekh commented 12 years ago

Hi - The following code in the Provider.php constructor obtains the call URL if the parameter is passed in: isset($options['callback']) and $this->callback = $options['callback'];

However, a few lines later the redirect URL is set to the URL of the page where the user initiated the auth request: $this->redirect_uri = site_url(get_instance()->uri->uri_string());

That redirect URL is passed to the provider and the callback URL appears never to be used. Replacing the first line I cited with the below seems to solve the issue. Am I right here?

    $this->redirect_uri = site_url(get_instance()->uri->uri_string()); //this line must be moved up above if statement from below

    if(isset($options['callback']) and $this->callback = $options['callback'])
    {
        $this->redirect_uri = $this->callback;      
    }
philsturgeon commented 11 years ago

Can you send this is as a pull request if it is not already taken care of? Thanks!