JSP Code -
Code is as below -
<%@ page language=“java” contentType=“text/html; charset=utf-8”
%>
open html tag
Insert title here
<script src="https://global.oktacdn.com/okta-signin-widget/5.1.5/js/okta-sign-in.min.js" type="text/javascript"></script>
<link href="https://global.oktacdn.com/okta-signin-widget/5.1.5/css/okta-sign-in.min.css" type="text/css" rel="stylesheet"/>
<!-- where the sign-in form will be displayed -->
<div id="okta-login-container"></div>
script tag starts here
signInWidgetConfig = {
// Enable or disable widget functionality with the following options. Some of these features require additional configuration in your Okta admin settings. Detailed information can be found here: https://github.com/okta/okta-signin-widget#okta-sign-in-widget
// Look and feel changes:
logo: '//logo.clearbit.com/someValidCompany.com', // Try changing "okta.com" to other domains, like: "workday.com", "splunk.com", or "delmonte.com"
language: 'en', // Try: [fr, de, es, ja, zh-CN] Full list: https://github.com/okta/okta-signin-widget#language-and-text
i18n: {
//Overrides default text when using English. Override other languages by adding additional sections.
'en': {
'primaryauth.title': 'Sign In', // Changes the sign in text
'primaryauth.submit': 'Sign In', // Changes the sign in button
// More e.g. [primaryauth.username.placeholder, primaryauth.password.placeholder, needhelp, etc.].
// Full list here: https://github.com/okta/okta-signin-widget/blob/master/packages/@okta/i18n/dist/properties/login.properties
}
},
// Changes to widget functionality
features: {
registration: true, // Enable self-service registration flow
rememberMe: true, // Setting to false will remove the checkbox to save username
//multiOptionalFactorEnroll: true, // Allow users to enroll in multiple optional factors before finishing the authentication flow.
//selfServiceUnlock: true, // Will enable unlock in addition to forgotten password
//smsRecovery: true, // Enable SMS-based account recovery
//callRecovery: true, // Enable voice call-based account recovery
router: true, // Leave this set to true for the API demo
},
baseUrl: 'https://dev-61xxx.okta.com',
el: '#okta-login-container',
clientId: 'clientID',
redirectUri: 'xxxRedirectURL',
authParams: {
issuer: 'https://dev-61xxx.okta.com/oauth2/default',
responseType: ['code'],
pkce: false,
// responseType: ['id_token', 'token'],
scopes: ['openid', 'email', 'profile'],
},
};
const oktaSignIn = new OktaSignIn(signInWidgetConfig);
oktaSignIn.showSignInAndRedirect({
el: '#okta-login-container'
}).catch(function(error) {
// This function is invoked with errors the widget cannot recover from:
// Known errors: CONFIG_ERROR, UNSUPPORTED_BROWSER_ERROR
alert('Catch unknown errors here which widget does not support');
});
script tag ends here
</he ad>
</bo dy>
close html tag