When I am authenticating my user, I can successfully do this, but when I try to retrieve the id or access tokens, it fails. I am brand new to Okta and just trying to get this to work. I am sure it is some configuration I am doing incorrectly, but need assistance, please!
Code:
Blockquote
oktaAuth.signIn({ username: user.email, password: user.password })
.then(function (transaction) {
if (transaction.status === “SUCCESS”) {
oktaAuth.token.getWithoutPrompt({
responseType: [‘id_token’, ‘token’],
sessionToken: transaction.sessionToken,
scopes: [“openid”, “email”, “profile”, “address”, “phone”]
})
.then(function (tokenOrTokens) {
var token = tokenOrTokens[1];
console.log("AccessToken: " + token.accessToken);
})
$window.localStorage[“auth”] = angular.toJson({
“sessionToken”: transaction.sessionToken,
“user”: transaction.user
});
oktaAuth.session.setCookieAndRedirect(transaction.sessionToken, ‘https://localhost:44376/Home/AuthMain’);
//$window.location.href = ‘/Home/AuthMain’;
}
});
The sign in is a success, but when it gets to the then function, it fails, saying
browser-ponyfill.js:516 POST https://dev-769222.okta.com/api/v1/authn 400 (Bad Request)
Can you please tell me the proper method to retrieve an access token is?
Thank you,
Rick