Android retrofit admin api authorization error
Hello. I want to get count of resources from android phone. I want to use admin api, as i understant admin api is not supported from android cloudinary library. I'm using retrofit for http request.
private static OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
private static Retrofit mRetrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(StaticKeys.API_AUTH_BASE_URL)
.build();
public static Call<List<ImageResourcesResponse>> getCloudinaryResources(StaticKeys.IMAGE tag) {
CloudinaryResources cloudinaryResources = mRetrofit.create(CloudinaryResources.class);
final String auth = "Basic " +
Base64.encodeToString(
(StaticKeys.API_KEY + ":" + StaticKeys.API_SECRET).getBytes(), Base64.NO_WRAP);
return cloudinaryResources.getInfoResources(auth);
}
public interface CloudinaryResources {
@GET("resources/image")
Call<List<ImageResourcesResponse>> getInfoResources(@Header("Authorization") String authorization);
}
And it always said, that i/m not authorized. What problem?
0
-
Hi,
Please note that exposing the API_SECRET in client-side code/ apps is not recommended.
To perform Admin API's operations, please use a server side code (e.g, using our Java SDK).
0
Post is closed for comments.
Comments
1 comment