1
0
Fork 0
mirror of synced 2024-06-29 03:30:34 +12:00

Merge pull request #455 from appwrite/oauth-redirect-fix

Fix for Missing redirect error on redirect from OAuth when using the …
This commit is contained in:
Eldad A. Fux 2020-06-28 11:57:29 +03:00 committed by GitHub
commit 1424f3c682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,8 +29,8 @@ use DeviceDetector\DeviceDetector;
use GeoIp2\Database\Reader;
use Utopia\Validator\ArrayList;
$oauthDefaultSuccess = $request->getServer('_APP_HOME').'/auth/oauth2/success';
$oauthDefaultFailure = $request->getServer('_APP_HOME').'/auth/oauth2/failure';
$oauthDefaultSuccess = '/auth/oauth2/success';
$oauthDefaultFailure = '/auth/oauth2/failure';
$oauth2Keys = [];
@ -508,8 +508,9 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect')
->addHeader('X-Fallback-Cookies', \json_encode([Auth::$cookieName => Auth::encodeSession($user->getId(), $secret)]))
;
}
if ($state['success'] === $oauthDefaultSuccess) { // Add keys for non-web platforms
// Add keys for non-web platforms - TODO - add verification phase to aviod session sniffing
if (parse_url($state['success'], PHP_URL_PATH) === $oauthDefaultSuccess) {
$state['success'] = URLParser::parse($state['success']);
$query = URLParser::parseQuery($state['success']['query']);
$query['project'] = $project->getId();