set_url(new moodle_url('local/auto_oauth2/redirector.php')); $PAGE->set_context(\context_system::instance()); $PAGE->set_title("Redirect"); redirect($CFG->wwwroot.'/auth/oauth2/login.php?id='.$id.'&wantsurl='.$pmurl.'&sesskey='.sesskey());