Hi,
no the client id etc is not real.
I’m trying to build a single page frontend app with VueJS/NuxtJS.
I have to use my own UI instead of the hosted login page.
I call this in my form page.
const webAuth = new auth0.WebAuth({
domain: ‘fitbot.eu.auth0.com’,
clientID: ‘AAFL5VodxzGNdaza0lvBTE0JT7lZ8oG4’,
responseType: ‘token’,
‘redirectUri’: ‘http://localhost:3000/callback’
});
On submit, this is called.
await webAuth.login({
realm: ‘Username-Password-Authentication’,
username: email,
password: password
}, function (err) {
if (err) {
console.log(err);
throw err.description;
}
It then logs me in (as far as i can see in the logs from the dashboard) and redirects me to.
http://localhost:3000/callback#access_token=GsHnQJPxQ9gak4VBgdDxGtUQKOoGhIsd1&scope=openid%20profile%20email&expires_in=7200&token_type=Bearer&state=3dqLECpdYK8B2DOgR5RZnOHNRldakpalB
I call parseHash() in the callback page where i should as far i as can see pass the hash to the method.
with this.
<----- CALLBACK page ------>
<script> export default { name: "callback", data: function () { this.$store.dispatch('handleAuthentication', this.$route.hash); console.log("callback page"); return {} } } </script>
<----- the script above code calls ----->
async handleAuthentication({commit}, Hash) {
await webAuth.parseHash({hash: Hash}, (err, authResult) => {
if (authResult) {
console.log(authResult);
commit('SET_USER', saveToken(authResult.accessToken));
} else if (err) {
commit('SET_USER', delToken());
}
});
}
The console.log(authResult) in that gives me following object:
{
“accessToken”: “GsHnQJPxQ9akg4VBgdDxGtUQKOoGhIsd1”,
“idToken”: null,
“idTokenPayload”: null,
“appState”: null,
“refreshToken”: null,
“state”: “3dqLECpdYK8B2DgOR5RZnOHNRldakpalB”,
“expiresIn”: 7200,
“tokenType”: “Bearer”,
“scope”: “openid profile email”
}
that access token doesn’t look right to me, I do a JWT check with saveToken() and it gives me a message “Invalid token specified: str is undefined”.
What am i doing wrong?
Do I call the wrong method inside the js SDK ?