-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
I want to connect my Vue3 App with Keycloak by using this Plugin.
My AuthService
import { AuthService, IAuthConfig } from 'ionic-appauth';
let authService: AuthService;
export const authConfig: IAuthConfig = {
client_id: 'treasurer',
server_host: 'http://192.168.188.20:8080/auth/realms/master',
redirect_url: 'http://192.168.188.20:9000',
end_session_redirect_url: 'http://192.168.188.20:9000',
scopes: 'openid profile email offline_access',
pkce: true
};
export default {
async initAuth() {
try {
authService = new AuthService();
authService.authConfig = authConfig;
await authService.init();
return authService;
} catch (error) {
console.error('Auth initialization error:', error);
throw error;
}
},
async login() {
try {
await authService.signIn();
} catch (error) {
console.error(error);
}
},
async logout() {
try {
await authService.signOut();
} catch (error) {
console.error(error);
}
},
async getAuthService() {
if (!authService) {
authService = await this.initAuth();
}
console.log(authService)
return authService;
}
};
My login Method.
const login = () => {
console.log('login')
AuthenticationService.getAuthService().then((authservice) => {
authservice.signIn().then((user) => {
console.log(user)
});
})
}
If i click on login my authService got initalised but i dont get redirected or anything else is coming up in the logs. Is my config wrong?
Metadata
Metadata
Assignees
Labels
No labels