The logout URL is:
https://{subdomain}}.okta.com/oauth2/default/v1/logout?id_token_hint=“.$_SESSION[‘okta_id_token’].”&post_logout_redirect_uri=http://google.com
In the Okta Admin Panel:
Sign-out redirect URIs: http://google.com
But it still doesn’t redirect. What am I doing wrong?
It seems that you need to close the session to do the redirect, but I would like to do this using Curl, but how to get the okta_session_cookie in PHP?
@andrea just need to redirect to logout URL for me to finish Okta authentication. Can you help me please?
Just for the record, I managed to redirect to the application when Okta logs out.
It was necessary to close the session and sign out in javascript
var config = {
issuer: ‘<?=$_ENV['OKTA_OAUTH2_ISSUER']?>’
};
var authClient = new OktaAuth(config);
const revokeAccessTok = async function() {
await authClient.revokeAccessToken(); // strongly recommended
}
authClient.closeSession();
// Sign out using the default options
authClient.signOut()
// Override the post logout URI for this call
authClient.signOut({
postLogoutRedirectUri: ´${location.origin}/mdlStart/index.php/logout´
});
// In this case, the ID token is stored under the ‘myIdToken’ key
const id_token = async function() {
var idToken = await authClient.tokenManager.get(‘<?=$_SESSION['okta_id_token']?>’);
authClient.signOut({
idToken: idToken
});
}
// In this case, the access token is stored under the ‘myAccessToken’ key
const access_token = async function() {
var accessToken = await authClient.tokenManager.get(‘<?=$_SESSION['okta_access_token']?>’);
authClient.signOut({
accessToken: accessToken
});
}