I’m just getting started using the Okta Sign-in Widget, and am having trouble following along with the examples.
- Embedded Okta Sign-In Widget fundamentals | Okta Developer
- Okta Authentication Quickstart Guides | Okta Developer
Specifically I am trying to follow the examples that specify response types of “token”. The documentation also refers to a responseType of “access_token”, but that isn’t shown in any of the examples so I’m not sure if it’s a typo.
The specific error I am having is that in the “success” callback there is code that looks like either this
oktaSignIn.renderEl(
{ el: '#okta-login-container' },
function success(res) {
if (res.status !== 'SUCCESS') {
return;
}
// Store the tokens in the TokenManager in the order requested
oktaSignIn.tokenManager.add('accessToken', res[0])
oktaSignIn.tokenManager.add('idToken', res[1])
return;
}, etcetera
or possibly this
oktaSignIn.renderEl(
{ el: '#okta-login-container' },
function success(res) {
if (res.status !== 'SUCCESS') {
return;
}
// Store the single token in the TokenManager
oktaSignIn.tokenManager.add('accessToken', res)
return;
}, etcetera
The error reported in the browser console occurs on the oktaSignIn.tokenManager.add call, and looks like this:
AuthSdkError: Token must be an Object with scopes, expiresAt, and an idToken or accessToken properties
The code that I used to create the authorization was a straight copy from the quickstart page
var oktaSignIn = new OktaSignIn({
baseUrl: "https://my-domain.oktapreview.com",
clientId: "my client id here",
authParams: {
issuer: "https://my-domain.oktapreview.com/oauth2/default",
responseType: 'token',
responseMode: 'query',
scopes: ['openid', 'profile', 'email']
}
});
For grins I also tried responseType: ‘access_token’ because who knows.
Any thoughts? Can’t find any hits in this forum, or anywhere else, on AuthSdkError.