'errorDescription'=>'No authorization code was provided in the request.'
'errorDescription'=>'No authorization code was provided in the request.'
));
));
$app->response()->body($html);
return;
return;
}
}
// Verify the state came back and matches what we set in the session
// Verify the state came back and matches what we set in the session
// Should only fail for malicious attempts, ok to show a not as nice error message
// Should only fail for malicious attempts, ok to show a not as nice error message
if(!array_key_exists('state',$params)){
if(!array_key_exists('state',$params)){
$html=render('auth_error',array(
render('auth_error',array(
'title'=>'Auth Callback',
'title'=>'Auth Callback',
'error'=>'Missing state parameter',
'error'=>'Missing state parameter',
'errorDescription'=>'No state parameter was provided in the request. This shouldn\'t happen. It is possible this is a malicious authorization attempt.'
'errorDescription'=>'No state parameter was provided in the request. This shouldn\'t happen. It is possible this is a malicious authorization attempt.'
));
));
$app->response()->body($html);
return;
return;
}
}
if($params['state']!=$_SESSION['auth_state']){
if($params['state']!=$_SESSION['auth_state']){
$html=render('auth_error',array(
render('auth_error',array(
'title'=>'Auth Callback',
'title'=>'Auth Callback',
'error'=>'Invalid state',
'error'=>'Invalid state',
'errorDescription'=>'The state parameter provided did not match the state provided at the start of authorization. This is most likely caused by a malicious authorization attempt.'
'errorDescription'=>'The state parameter provided did not match the state provided at the start of authorization. This is most likely caused by a malicious authorization attempt.'