From the developer console, I made a custom sign-in page. I have added a login button from the Mircosoft. It does work, but after login, I am being redirected to https://mydomain.com/app/userhome. Is there a way to change this. Here is the code I used:
<!--
"OktaUtil" defines a global OktaUtil object
that contains methods used to complete the Okta login flow.
-->
{{{OktaUtil}}}
<script type="text/javascript">
var config = {
baseUrl: orgUrl,
idps: [
{id: 'this_is_private', text: 'Login met Microsoft'}
]
}
// Render the Okta Sign-In Widget
var oktaSignIn = new OktaSignIn(config);
oktaSignIn.renderEl({ el: '#okta-login-container' },
function success(res) {
if(res.status === 'SUCCESS'){
res.session.setCookieAndRedirect(http://localhost:8080);
},
function error(err) {
// This function is invoked with errors the widget cannot recover from:
// Known errors: CONFIG_ERROR, UNSUPPORTED_BROWSER_ERROR
}
);
</script>
You can configure the widget to do a simple OIDC flow and redirect you to a specific page once the flow is completed. You can find here an example for implicit flow.
From widget point of view, you will need to set a few more attributes under config:
redirectUri - the URL where to redirect (this needs to be whitelisted also in the OIDC app in Okta)
clientId: the OIDC app’s client ID which can be found under the General tab
authParams.issuer - the issuer of the authorization server used
authParams.responseType - id_token, token or both
authParams.display - “page”
authParams.scopes - the scopes requested (it can be set to openid)
Yes, but I had to fill in in the parameters. not in the config.
customButtons: [{
title: 'Login met Microsoft',
className: 'btn-microsoft',
click: function() {
// clicking on the button navigates to another page
window.location.href = 'youroktadomain.com/redirect_uri=https://www.google.com&state=WM6D&nonce=YsG76jo';
}
}
I have tried but its not work for me , I need same as facebook work in Okta , it redirect to Fb , but I want to redirect to Okta login and after success to my home page