I want to add google social button to my project instead of using the default login page of keycloak

I know all how to configure google IDP, but I want to add google social button to my project instead of using the default login page of keycloak, and I also need to get the accessToken generated by the google login user in keycloak, thank you

When you want such tight integration with google, why would you want to use keycloak in this case? Seems to me your better of integrating with google directly?

@edewit, Thank you for your suggestions, because my project is protected by keycloak, and keycloak can be easily provided by IDP, so it is more appropriate to use keycloak as authorization authentication. Now, I don’t know how to generate accessToken, just like my registered users through keycloak. And I searched on google for a long time, but did not find a similar solution.

So if I understand you correct, you want to generate a IDP google button in your webapp without using the keycloak login page? And then still be able to get the accessToken?

If you want a link same as the login page you can do this:

keycloak.createLoginUrl({
        idpHint: 'google'
});

for more information

1 Like

Yes
Can I get user’s accessToken by this?

No, this will enable you to create the login url for your frontend application. To get the accessToken you can use: keycloak.token, read more about the Javascript adapter

ok, I got it
Thank you so much!