guess icon indicating copy to clipboard operation
guess copied to clipboard

Error: No access, refresh token or API key is set.

Open subhojit-cn opened this issue 5 years ago • 5 comments

When I try to build the simple angular app with guess js. It's giving me the error.

My "extend.webpack.config.js" is like below:

const { GuessPlugin } = require('guess-webpack');
const { parseRoutes } = require('guess-parser');

module.exports = {
  plugins: [
    new GuessPlugin({
        GA: '', //ga code is not here because for security reason
        routeProvider() {
            return parseRoutes('.');
        },
        runtime: {
            delegate: false
        }
    })
  ]
};

The build error is like that.

cn4s-MacBook-Pro:guess-angular cn4$ npm run build

> [email protected] build /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular
> ng build

95% emitting GuessPluginError: No access, refresh token or API key is set.
    at OAuth2Client.getRequestMetadataAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:249:19)
    at OAuth2Client.requestAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:337:34)
    at OAuth2Client.request (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:331:25)
    at createAPIRequestAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis-common/build/src/apirequest.js:248:27)
    at Object.createAPIRequest (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis-common/build/src/apirequest.js:44:9)
    at Resource$Reports.batchGet (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis/build/src/apis/analyticsreporting/v4.js:80:37)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6740
    at new Promise (<anonymous>)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6703
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:5610
    at Object.next (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:5715)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:4627
    at new Promise (<anonymous>)
    at r (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:4372)
    at s (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6634)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:7578
(node:1185) UnhandledPromiseRejectionWarning: Error: No access, refresh token or API key is set.
    at OAuth2Client.getRequestMetadataAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:249:19)
    at OAuth2Client.requestAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:337:34)
    at OAuth2Client.request (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/google-auth-library/build/src/auth/oauth2client.js:331:25)
    at createAPIRequestAsync (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis-common/build/src/apirequest.js:248:27)
    at Object.createAPIRequest (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis-common/build/src/apirequest.js:44:9)
    at Resource$Reports.batchGet (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/googleapis/build/src/apis/analyticsreporting/v4.js:80:37)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6740
    at new Promise (<anonymous>)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6703
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:5610
    at Object.next (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:5715)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:4627
    at new Promise (<anonymous>)
    at r (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:4372)
    at s (/Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:6634)
    at /Users/cn4/Documents/subhojit/practice/guess-js/guess-angular/node_modules/guess-ga/dist/guess-ga/index.js:1:7578
(node:1185) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:1185) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Please help me to resolve this issue.

subhojit-cn avatar Nov 25 '19 03:11 subhojit-cn

Do you provide access to your GA report via the OAuth popup?

mgechev avatar Nov 25 '19 14:11 mgechev

Yes, I gave permission on oAuth popup.

First, a browser opens according to below link screenshot: https://drive.google.com/file/d/1hkvD85_E2S4QOq9TcOwRDyvp6hWoinzx/view?usp=sharing

Then the permission popup comes and I gave permission and then it redirects in a link and doesn't able to run the server. https://drive.google.com/file/d/1l8TIQo2WdOIm2SzYpH8Ufqjy9E2iYNHp/view?usp=sharing

Please check and let me know what thing I miss!

subhojit-cn avatar Nov 26 '19 04:11 subhojit-cn

First, a browser opens according to below link screenshot: https://drive.google.com/file/d/1hkvD85_E2S4QOq9TcOwRDyvp6hWoinzx/view?usp=sharing

Here you click on "Go to guess-js (unsafe)", right?

Then the permission popup comes and I gave permission and then it redirects in a link and doesn't able to run the server. https://drive.google.com/file/d/1l8TIQo2WdOIm2SzYpH8Ufqjy9E2iYNHp/view?usp=sharing

Yes, this looks like the problem. I cannot reproduce the issue locally. Do you have a constraint on opening a port on your machine?

mgechev avatar Nov 27 '19 12:11 mgechev

Here you click on "Go to guess-js (unsafe)", right?

Yes I did "Go to guess-js (unsafe)"

Yes, this looks like the problem. I cannot reproduce the issue locally. Do you have a constraint on opening a port on your machine?

I am can't able to check that. Can you please let me know how to check on the mac laptop?

Please give me some solution for this so I can implement guess js in my angular projects.

subhojit-cn avatar Nov 28 '19 08:11 subhojit-cn

@subhojit-cn you can use the JWT solution from this issue.

mgechev avatar Feb 16 '20 04:02 mgechev