eventOneHQ / apkup

🚀 Publish APKs to Google Play directly from the terminal
https://oss.eventone.page/apkup
MIT License
36 stars 12 forks source link

Forbidden #15

Closed sravan1000 closed 4 years ago

sravan1000 commented 4 years ago

error stack:

"Error: Forbidden at Gaxios._request (/home/sravan/data/publish-play/node_modules/gaxios/build/src/gaxios.js:85:23) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async JWT.requestAsync (/home/sravan/data/publish-play/node_modules/apkup/node_modules/google-auth-library/build/src/auth/oauth2client.js:346:18)"

nprail commented 4 years ago

Thanks for moving this over here :)

How are you using apkup? CLI or library? Could you provide a code snippet of what you called? This looks like it is probably an issue with your authentication key.

sravan1000 commented 4 years ago

Hello here is the code snippet how i am using and i am using as library

import { Apkup } from 'apkup'

const auth = require('../key.json')
// const apkup = new Apkup(auth);

// require("../release/app.apk")

async function runApkUp(){

    try{

        const apkup = new Apkup({
            client_email: auth.client_email,
            private_key: auth.private_key
        });

        let data = await apkup.upload("release/app.apk",{
            track:"beta",
            releaseNotes: [
                {
                    language:"en-us",
                    text:"this is release done by automation.."
                }
            ]
        });

        if(data){
            console.log(` > ${data.packageName} version ${data.versionCode} is up!`);
        }
    }catch(error){
        console.log(error);
    }
}
runApkUp();
nprail commented 4 years ago

@sravan1000 Add a console.log of auth after the key is required. Make sure that client_email and private_key are actually defined.

DO NOT post the console.log results here :)

sravan1000 commented 4 years ago

hey,

they were taken from key json file which was given from google play api (values were actually there)

there it was getting a Forbidden and you can log and see the results

nprail commented 4 years ago

Okay, sounds like it is an issue with the key itself then.

Try following the authentication instructions in the README and double-check to make sure that your service account has the Release manager permission.

sravan1000 commented 4 years ago

okay, will check and let you know asap

sravan1000 commented 4 years ago

Hello, thank you for the response i think it is because permissions of service account. Thank you

nprail commented 4 years ago

I'm glad you got it resolved 😃

That documentation on setting up the authentication could probably use an update. I think the flow has changed a bit since they were written.