-
Pre-submission Checklist
Question Category
Your QuestionI'm playing with the new client side oauth support from #785 It says here that the token should be automatically refreshed Line 356 in 4cdbaaf I skimmed the PR and don't see where that's implemented. Is there some extra config needed? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Hi @djoreilly, thanks for asking. We're using
If so, it would be good to check if the library even tries to execute the refresh calls, e.g. by adding some debug prints inside https://cs.opensource.google/go/x/oauth2/+/refs/tags/v0.36.0:oauth2.go;l=274. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the pointers. Yes, running tcpflow on the Keycloak port shows the access token has an expiry (10 min as set in keycloak) and there is a refresh token too. {"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhSk9HcjlIaUIxLWdwWUJ2QXEwVno2RXNzbVQ1eEFIYXhVRGdBc0VhS0dNIn0.eyJleHAiOjE3NzMyMjgxMjQsImlhdCI6MTc3MzIyNzUyNCwiYXV0aF90aW1lIjoxNzczMjI3NTI0LCJqdGkiOiJvbnJ0YWM6OTgxNDdlM2ItODJkNi00NzAwLWE2MmQtOGU0NWIwOTY1MzEwIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDkwL3JlYWxtcy9tY3AtcmVhbG0iLCJhdWQiOiJlY2hvLW1jcC1zZXJ2ZXIiLCJzdWIiOiIzYjE5ZGE4My00Zjc5LTRkZTAtYmU5Ni1kZjA5Y2FjOWRhZjkiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJtY3AtdGVzdC1jbGllbnQiLCJzaWQiOiI2NWQwZjBjYS1iMjJiLWVjOTItMTcxNC0yNjMzMzkzMDQyOGIiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIioiXSwicmVzb3VyY2VfYWNjZXNzIjp7ImVjaG8tbWNwLXNlcnZlciI6eyJyb2xlcyI6WyJ0b29scy13cml0ZSIsInRvb2xzLXJlYWQiXX19LCJzY29wZSI6Im1jcDp0b29sczp3cml0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iJtY3AtdGVzdC1jbGllbnQiLCJzaWQiOiI2NWQwZjBjYS1iMjJiLWVjOTItMTcxNC0yNjMzMzkzMDQyOGIiLCJzY29wZSI6ImFjciBtY3A6dG9vbHM6d3JpdGUgYmFzaWMgcm9sZXMgbWNwOnRvb2xzOnJlYWQgd2ViLW9yaWdpbnMgZW1haWwgcHJvZmlsZSBlY2hvLW1jcC1zZXJ2ZXItYXVkaWVuY2UifQ.j_aPrYz_Zg-KxkUFrTdPjgKK8x2m8h2UdMYaWavznNuSd9T_7HK6Q7Z_lzInWqaep6QqZwEre4ddi8e2YkRTYg","token_type":"Bearer","not-before-policy":0,"session_state":"65d0f0ca-b22b-ec92-1714-26333930428b","scope":"mcp:tools:write mcp:tools:read email profile echo-mcp-server-audience"}I'll add some debug to the oauth2 refresh code. |
Beta Was this translation helpful? Give feedback.
-
|
Refresh is working now - the problem was with the keycloak config. The access token expiry was 3600s (set by a setup script, probably not a keycloak default), but 3600s is the same as the refresh token expiry, so I guess the refresh token is invalid when it comes time to use it. After I reduced the access token expiry to 600s I'm seeing the access tokens getting refreshed. |
Beta Was this translation helpful? Give feedback.
Refresh is working now - the problem was with the keycloak config. The access token expiry was 3600s (set by a setup script, probably not a keycloak default), but 3600s is the same as the refresh token expiry, so I guess the refresh token is invalid when it comes time to use it. After I reduced the access token expiry to 600s I'm seeing the access tokens getting refreshed.