Hello,
I wanted to connect my VueJs 3 app with Okta for login, so i followed this tutorial Sign in to SPA with Auth JS | Okta Developer, and i created an OIDC SPA app in Okta.
This is my code and the settings:
import OktaAuth from '@okta/okta-auth-js'
const authClient = new OktaAuth({
issuer: 'https://dev-480.okta.com/oauth2/default',
clientId: '0oa9kmqdl0EagCnWV5d7',
scopes: ['openid', 'email', 'profile'],
redirectUri: 'http://localhost:8080/login/callback/'
})
const signIn = (event) => {
event.preventDefault()
isLoading.value = true
authClient.signInWithCredentials({
username: credentials.username,
password: credentials.password
}).then(transaction => {
console.log(transaction, "transaction")
if (transaction.status === 'SUCCESS') {
return authClient.token.getWithoutPrompt({
responseType: ['id_token', 'token'],
sessionToken: transaction.sessionToken,
}).then(response => {
console.log(response, "response")
localStorage.token = response.tokens.accessToken
localStorage.idToken = response.tokens.idToken
isLoading.value = false
}).catch(err =>{
console.log(err, "whatttt")
})
}
}).catch(err => {
isLoading.value = false
console.error(err.message)
})
When i call the function signInWithCredentials, i got a SUCCESS status with my session token, but when i want to call authClient.token.getWithoutPrompt, i got this error: AuthSdkError: OAuth flow timed out, i searched everywhere but no one get the same problem as me. If someone already have this error, i will be very helpful
Have a nice day,