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

Must supply api_key #664

Open
sohaibkhan-007 opened this issue Jun 13, 2024 · 1 comment
Open

Must supply api_key #664

sohaibkhan-007 opened this issue Jun 13, 2024 · 1 comment

Comments

@sohaibkhan-007
Copy link

sohaibkhan-007 commented Jun 13, 2024

There was an unexpected error (type=Internal Server Error, status=500).
Must supply api_key
java.lang.IllegalArgumentException: Must supply api_key

//here is my proprties file code
#cloudinary configurations
cloudinary.cloud.name=ddxv9r6it
cloudinary.api.key=884911427739699
cloudinary.api.secret=DELETED

//its AppConfig file
@configuration
public class AppConfig {
@value("${cloudinary.cloud.name}")
private String cloudName;
@value("${cloudinary.api.key}")
private String apiKey;
@value("${cloudinary.api.secret}")
private String apiSecret;
@bean
public Cloudinary cloudinary() {
ObjectUtils.asMap(
"cloud_name", cloudName,
"api_key", apiKey,
"api_secret", apiSecret);
return new Cloudinary();
}
}

@PixelCook
Copy link

Hey there,

Please never share your API secret anywhere publically. I've gone ahead and deleted this from your post but please go into your account and create a new API key to use.

That being said it looks like you're trying to inject values from a properties file into your Java application using Spring's @value annotation, but it appears there might be a small issue with your configuration.

I'm not super familiar with Java but I believe you need to declare a new instance of Cloudinary:

import com.cloudinary.*; ... Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap( "cloud_name", "my_cloud_name", "api_key", "my_api_key", "api_secret", "my_api_secret", "secure", true));

Check out our docs for more info https://cloudinary.com/documentation/java_integration#installation_and_setup

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