I have configured http://localhost:62114 and http://localhost:62114/ as trusted origins for the API. The odd thing to me is that if I use the redirect flow (as opposed to the widget), it works fine.
I have also tested with the okta-aspnetcode-mvc-example code and that seems to work fine.
Any thoughts would be appreciated. This is my configuration for the widget:
<script type="text/javascript">
const signIn = new OktaSignIn({
/**/
baseUrl: 'https://dev-586182.oktapreview.com/'
/**/
});
signIn.renderEl({ el: '#widget' }, (res) => {
var sessionTokenField = $("#hiddenSessionTokenField");
sessionTokenField.val(res.session.token);
var form = sessionTokenField.parent();
form.submit();
}, (err) => {
console.error(err);
});
</script>
If you go to the resource-server example, there is a list of our front-end sample applications (Vue, React, and Angular) to demonstrate the interaction with the resource server.
For example, if you go to the React repo, you will see a custom-login example which uses the widget.
If you want to use the plain js widget, then try with the next configuration:
var oktaSignIn = new OktaSignIn({
baseUrl: "https://dev-586182.oktapreview.com/",
clientId: "{clientId}",
authParams: {
issuer: "https://dev-586182.oktapreview.com/oauth2/default",
responseType: ['token', 'id_token'],
display: 'page'
}
});
Thanks, I’m working on a ASP.NET MVC project (not a Single Page App (SPA)). The examples all seem to be more geared to a Angular type of implementation. The example I had posted in my original message is closest to what I’m trying to do.