diff --git a/src/main/java/biz/nynja/auth/grpc/services/interceptors/AuthenticationServiceInterceptor.java b/src/main/java/biz/nynja/auth/grpc/services/interceptors/AuthenticationServiceInterceptor.java index 436959ade542e7389b1b26e9813d83937bbf6a6c..97a971689c470d25d111645525082a8113e1892c 100644 --- a/src/main/java/biz/nynja/auth/grpc/services/interceptors/AuthenticationServiceInterceptor.java +++ b/src/main/java/biz/nynja/auth/grpc/services/interceptors/AuthenticationServiceInterceptor.java @@ -29,13 +29,27 @@ public class AuthenticationServiceInterceptor implements ServerInterceptor { /** * @Date 27-May-2020 * @UpdatedBy Jayendra - * Checking if the request is made by Desktop application + * Checking if the request is made by Desktop application to update redirect URI for facebook and google + * */ if (metadata.get(Metadata.Key.of("user-agent", ASCII_STRING_MARSHALLER)).contains("Electron") || metadata.get(Metadata.Key.of("user-agent", ASCII_STRING_MARSHALLER)).contains("electron") ) { - ctx = Context.current().withValues(AuthenticationServiceConstants.ACCESS_TOKEN_CTX, tokenParts[1], AuthenticationServiceConstants.DESKTOP_APP_REQUEST_CTX, DesktopAppRequestConstants.YES); + /** + * Special condition If request is from Electron/5.0.... then we will mark DesktopRequest to be No + * Since, we don't want to change redirect URI to desktop redirectURI for google and facebook in this case. + */ + if (metadata.get(Metadata.Key.of("user-agent", ASCII_STRING_MARSHALLER)).contains("Electron/5") || + metadata.get(Metadata.Key.of("user-agent", ASCII_STRING_MARSHALLER)).contains("electron/5") + ) { + + ctx = Context.current().withValues(AuthenticationServiceConstants.ACCESS_TOKEN_CTX, tokenParts[1], AuthenticationServiceConstants.DESKTOP_APP_REQUEST_CTX, DesktopAppRequestConstants.NO); + + } else { + + ctx = Context.current().withValues(AuthenticationServiceConstants.ACCESS_TOKEN_CTX, tokenParts[1], AuthenticationServiceConstants.DESKTOP_APP_REQUEST_CTX, DesktopAppRequestConstants.YES); + } } else {