diff --git a/src/main/java/io/supertokens/oauth/OAuth.java b/src/main/java/io/supertokens/oauth/OAuth.java index aa2192247..3e1fc0544 100644 --- a/src/main/java/io/supertokens/oauth/OAuth.java +++ b/src/main/java/io/supertokens/oauth/OAuth.java @@ -367,12 +367,18 @@ public static void addOrUpdateClient(Main main, AppIdentifier appIdentifier, Sto } private static String encryptClientSecret(Main main, String clientSecret) throws InvalidConfigException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { + if (clientSecret == null) { + return null; + } String key = Config.getConfig(main).getOAuthClientSecretEncryptionKey(); clientSecret = Utils.encrypt(clientSecret, key); return clientSecret; } private static String decryptClientSecret(Main main, String clientSecret) throws InvalidConfigException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { + if (clientSecret == null) { + return null; + } String key = Config.getConfig(main).getOAuthClientSecretEncryptionKey(); clientSecret = Utils.decrypt(clientSecret, key); return clientSecret;