Open shubyaa opened 2 weeks ago
I have also tried using client library, that too has the same issue
import { google } from "googleapis";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Path to your service account JSON key file
const serviceAccountPath = path.join(
__dirname,
"./firebase_service_account_key.json"
);
// Authenticate using a service account
const auth = new google.auth.GoogleAuth({
keyFile: serviceAccountPath,
scopes: ["https://www.googleapis.com/auth/androidpublisher"], // Required scope
});
// Initialize the Google Play Developer API
const androidpublisher = google.androidpublisher({
version: "v3", // Version of the API
auth: auth, // Pass in the authenticated client
});
// Function to check subscription status
const checkSubscriptionStatus = async (packageName, subscriptionId, token) => {
try {
const res = await androidpublisher.purchases.subscriptions.get({
packageName: packageName,
subscriptionId: subscriptionId,
token: token,
});
console.log("Subscription Status:", res.data);
} catch (error) {
console.error("Error checking subscription:", error);
}
};
// Replace with actual values
const packageName = "com.example.myapp";
const subscriptionId = "<xoxo>";
const token = "<token>"
// Call the function
checkSubscriptionStatus(packageName, subscriptionId, token);
Hi, can anyone drop the set of permissions for the service account, I tried the sample test code to call the API
This code still returns me 401 error, I have also done inviting service account in my play console. I feel like for the scope android publisher, I might me missing some permissions. The permissions associated with the current service account are these :
If anyone know what I might be missing, it will be a great help.
Thanks.