fix: set refresh token in the RetrieveIdentityIntentResponse (#11613)

# Which Problems Are Solved

This PR adds support for storing and retrieving refresh tokens from
external identity providers during the IDP intent flow.

# How the Problems Are Solved

* Updated `idp.proto` (v2 and v2beta): added an optional `refresh_token`
field to `IDPOAuthAccessInformation`, which, in turn, is used in
`RetrieveIdentityProviderIntentResponse`
* Added the `IDPRefreshToken` field to the IDP intent `SucceededEvent`
struct, and updated the corresponding constructor to set the refresh
token
* Added the `IDPRefreshToken` field to `IDPIntentWriteModel`, and
updated `reduceOAuthSucceededEvent` to populate refresh token from
events
* Updated `tokensForSucceededIDPIntent` function to extract and encrypt
the refresh token from IDP session, if set
* Updated `idpOAuthTokensToPb` function to decrypt refresh token before
returning to clients
* Updated unit and integration tests

# Additional Changes
Updated the link to the JWT IDP docs linked in the Console

# Additional Context
- Closes https://github.com/zitadel/zitadel/issues/11047
This commit is contained in:
Gayathri Vijayan
2026-02-19 06:06:30 +00:00
committed by GitHub
parent a5a5b65931
commit 6ad1ef859b
13 changed files with 224 additions and 77 deletions
+18 -2
View File
@@ -129,8 +129,24 @@ message IDPInformation{
}
message IDPOAuthAccessInformation{
string access_token = 1;
optional string id_token = 2;
// The access token returned by the external identity provider.
string access_token = 1[
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "Access token returned by the external identity provider"
}
];
// The ID token is only set when it is returned by the external identity provider.
optional string id_token = 2[
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "ID token returned by the external identity provider. Only set if the external identity provider returns an ID token."
}
];
// The refresh token is only set when it is returned by the external identity provider.
optional string refresh_token = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "Refresh token returned by the external identity provider. Only set if the external identity provider returns a refresh token."
}
];
}
message IDPLDAPAccessInformation{
+18 -2
View File
@@ -129,8 +129,24 @@ message IDPInformation{
}
message IDPOAuthAccessInformation{
string access_token = 1;
optional string id_token = 2;
// The access token returned by the external identity provider.
string access_token = 1[
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "Access token returned by the external identity provider"
}
];
// The ID token is only set when it is returned by the external identity provider.
optional string id_token = 2[
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "ID token returned by the external identity provider. Only set if the external identity provider returns an ID token."
}
];
// The refresh token is only set when it is returned by the external identity provider.
optional string refresh_token = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "Refresh token returned by the external identity provider. Only set if the external identity provider returns a refresh token."
}
];
}
message IDPLDAPAccessInformation{