Hi,
I’m using signIn widget for login form, and I configured the OIDC. I have some issues since then.
-
After that, I am not able to sign In with username+password as usual. Instead, it will show that I logged In through Google/Facebook on okta dashboard. Wondering if I’m configured right
-
Social sign on only returns id_token or accessToken to me. How can I check the user’s session on OKTA? is there a way that I can extend the session?
var config = { baseUrl: 'https://dev-xxxxx.oktapreview.com', logo: '../static/images/logo.png', helpSupportNumber: '(123) 444-1111', language: 'en', i18n: { en: { 'primaryauth.title': 'Sign in to XXXXX', } }, helpLinks: { help: 'http://www.XXXXXX.com/contact', forgotPassword: '/forgot', }, clientId: 'XXXXXXXXXX', // URL redirectUri: 'http://localhost:5555/test', idps: [{type: 'GOOGLE', id: '0oXXXXXXXXXh7'}], authParams: { display: 'popup', responseType: ['id_token', 'token'] }, features: { registration: true, }, registration: { click: function() { window.location.href = '/signup'; } } }
var oktaSignIn = new OktaSignIn(config);
oktaSignIn.renderEl(
{ el: '#okta-login-container' },
function success(res) {
if (res.status === 'FORGOT_PASSWORD_EMAIL_SENT') {
// Any followup action you want to take
return;
}
if (res.status === 'UNLOCK_ACCOUNT_EMAIL_SENT') {
// Any followup action you want to take
return;
}
// The user has successfully completed the authentication flow
if (res.status === 'SUCCESS') {
// Handle success when the widget is not configured for OIDC
if (res.type === 'SESSION_STEP_UP') {
// Session step up response
// If the widget is not configured for OIDC and the authentication type is SESSION_STEP_UP,
// the response will contain user metadata and a stepUp object with the url of the resource
// and a 'finish' function to navigate to that url
console.log('SESSION_STEP_UP');
console.log(res.user);
console.log('Target resource url: ' + res.stepUp.url);
res.stepUp.finish();
return;
} else if (res[0].claims) {
console.log("claims");
// OIDC response
// If the widget is configured for OIDC with a single responseType, the
// response will be the token.
// i.e. authParams.responseType = 'id_token':
console.log(res);
console.log(res.claims);
// oktaSignIn.tokenManager.add('my_id_token', res);
// If the widget is configured for OIDC with multiple responseTypes, the
// response will be an array of tokens:
// i.e. authParams.responseType = ['id_token', 'token']
// oktaSignIn.tokenManager.add('my_id_token', res[0]);
// oktaSignIn.tokenManager.add('my_access_token', res[1]);
return;
} else {
return;
}
return;
}
},
function error(err) {
console.log("error!!!");
console.log(err);
});