Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Exchange By User Email #4

Open
gustavohfelixs opened this issue Sep 16, 2024 · 3 comments
Open

Token Exchange By User Email #4

gustavohfelixs opened this issue Sep 16, 2024 · 3 comments

Comments

@gustavohfelixs
Copy link

gustavohfelixs commented Sep 16, 2024

Hello czetsuyatech! I recently watched your video about this repo and was really helpful to understand keycloak exchange but now i'm trying to do a token exchange by user email.

I'm building an app that can make appointments in google agenda and I faced a problem have muiltiple user token and refresh_tokens for consume google API. Some friend told me about keycloak and it capacibility to have identity provider login with google and store tokens of users.

My app is a backend node app and i dont want user logging each time for making agenda changes just login once and automate the rest.

Can u help me please?

@czetsuya
Copy link
Collaborator

Hi Gustavo,

That is the use case for that repo wherein you limit the login by exchanging tokens.

Did you try to run the project and see how it behaves?

@gustavohfelixs
Copy link
Author

gustavohfelixs commented Sep 16, 2024

Hi Gustavo,

That is the use case for that repo wherein you limit the login by exchanging tokens.

Did you try to run the project and see how it behaves?

Hello Ed, thank u for answer! I tried this repo, created the keycloak realm, client and implemented the identity provider with login by localhost:8081 using your java Spring boot app. But the problem that i saw was that the user needs to be logged (with session in browser) to be able use the google api, please correct me if i'm wrong.

What i needing for this personal project is exchange my user information (token, refresh_token) to make changes in the user agenda while in my backend that dont have session. I want to user log once and it be able to make appointments and my app be a multi tenancy google agenda consumer doing appointments for muiltiple users.

I dont know if this is the best way to do that. But here is the idea:

  • User login in my web app (Keycloak with Google)
  • user send a notification in a webhook
  • BackEnd Webhook receives the appointment
  • Recover user token
  • Create a appointment in user agenda

@czetsuya
Copy link
Collaborator

Hi @gustavohfelixs there should be an endpoint in oauthController to save the access and refresh tokens that you can use later to initialize the Google services. You can use the refresh token to regenerate a new pair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants