Google oauth2.0 showing Invalid client error












0















I'm trying to set up google Oauth in this application. I've created config for both remote and production server. It's working fine in the development env but getting this error in the production env which is Heroku.



gettin this error :



401. That’s an error.

Error: invalid_client

The OAuth client was not found.

Request Details
response_type=code
redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback
scope=profile email
client_id=process.env.GOOGLE_CLIENT_ID


From this end point : https://vast-ridge-80091.herokuapp.com/auth/google



This is my config settings for the production environment



module.exports = {

googleClientID:'process.env.GOOGLE_CLIENT_ID',
googleClientSecret:'process.env.GOOGLE_CLIENT_SECRET',
monoURI:'process.env.MONGO_URI',
cookieKey:'process.env.COOKIE_KEY'

};



if(process.env.NODE_ENV === 'production'){
module.exports = require('./prod');
}else{
module.exports = require('./dev');
}


I've updated the env variable in the heroku app settings and double checked everything, those credentials are correct.



This is my Heroku log :



remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.15.0...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass@4.11.0 install
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-
sass/releases/download/v4.11.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.hFNmC/node-sass/4.11.0/linux-
x64-64_binding.node
remote:
remote: > node-sass@4.11.0 postinstall
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 305 packages from 198 contributors and audited 811
packages in 9.098s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 811 packages in 2.556s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 25.9M
remote: -----> Launching...
remote: Released v3
remote: https://vast-ridge-80091.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.


I've tried some solutions dicussed here : invalid_client in google oauth2



But still No luck.



Any kind of help will be a bliss.










share|improve this question

























  • Check the reply url in the google app

    – Max
    Jan 19 at 16:18











  • This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

    – MDIPANJAN
    Jan 19 at 19:09













  • The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

    – Max
    Jan 21 at 10:13
















0















I'm trying to set up google Oauth in this application. I've created config for both remote and production server. It's working fine in the development env but getting this error in the production env which is Heroku.



gettin this error :



401. That’s an error.

Error: invalid_client

The OAuth client was not found.

Request Details
response_type=code
redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback
scope=profile email
client_id=process.env.GOOGLE_CLIENT_ID


From this end point : https://vast-ridge-80091.herokuapp.com/auth/google



This is my config settings for the production environment



module.exports = {

googleClientID:'process.env.GOOGLE_CLIENT_ID',
googleClientSecret:'process.env.GOOGLE_CLIENT_SECRET',
monoURI:'process.env.MONGO_URI',
cookieKey:'process.env.COOKIE_KEY'

};



if(process.env.NODE_ENV === 'production'){
module.exports = require('./prod');
}else{
module.exports = require('./dev');
}


I've updated the env variable in the heroku app settings and double checked everything, those credentials are correct.



This is my Heroku log :



remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.15.0...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass@4.11.0 install
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-
sass/releases/download/v4.11.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.hFNmC/node-sass/4.11.0/linux-
x64-64_binding.node
remote:
remote: > node-sass@4.11.0 postinstall
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 305 packages from 198 contributors and audited 811
packages in 9.098s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 811 packages in 2.556s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 25.9M
remote: -----> Launching...
remote: Released v3
remote: https://vast-ridge-80091.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.


I've tried some solutions dicussed here : invalid_client in google oauth2



But still No luck.



Any kind of help will be a bliss.










share|improve this question

























  • Check the reply url in the google app

    – Max
    Jan 19 at 16:18











  • This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

    – MDIPANJAN
    Jan 19 at 19:09













  • The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

    – Max
    Jan 21 at 10:13














0












0








0








I'm trying to set up google Oauth in this application. I've created config for both remote and production server. It's working fine in the development env but getting this error in the production env which is Heroku.



gettin this error :



401. That’s an error.

Error: invalid_client

The OAuth client was not found.

Request Details
response_type=code
redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback
scope=profile email
client_id=process.env.GOOGLE_CLIENT_ID


From this end point : https://vast-ridge-80091.herokuapp.com/auth/google



This is my config settings for the production environment



module.exports = {

googleClientID:'process.env.GOOGLE_CLIENT_ID',
googleClientSecret:'process.env.GOOGLE_CLIENT_SECRET',
monoURI:'process.env.MONGO_URI',
cookieKey:'process.env.COOKIE_KEY'

};



if(process.env.NODE_ENV === 'production'){
module.exports = require('./prod');
}else{
module.exports = require('./dev');
}


I've updated the env variable in the heroku app settings and double checked everything, those credentials are correct.



This is my Heroku log :



remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.15.0...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass@4.11.0 install
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-
sass/releases/download/v4.11.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.hFNmC/node-sass/4.11.0/linux-
x64-64_binding.node
remote:
remote: > node-sass@4.11.0 postinstall
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 305 packages from 198 contributors and audited 811
packages in 9.098s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 811 packages in 2.556s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 25.9M
remote: -----> Launching...
remote: Released v3
remote: https://vast-ridge-80091.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.


I've tried some solutions dicussed here : invalid_client in google oauth2



But still No luck.



Any kind of help will be a bliss.










share|improve this question
















I'm trying to set up google Oauth in this application. I've created config for both remote and production server. It's working fine in the development env but getting this error in the production env which is Heroku.



gettin this error :



401. That’s an error.

Error: invalid_client

The OAuth client was not found.

Request Details
response_type=code
redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback
scope=profile email
client_id=process.env.GOOGLE_CLIENT_ID


From this end point : https://vast-ridge-80091.herokuapp.com/auth/google



This is my config settings for the production environment



module.exports = {

googleClientID:'process.env.GOOGLE_CLIENT_ID',
googleClientSecret:'process.env.GOOGLE_CLIENT_SECRET',
monoURI:'process.env.MONGO_URI',
cookieKey:'process.env.COOKIE_KEY'

};



if(process.env.NODE_ENV === 'production'){
module.exports = require('./prod');
}else{
module.exports = require('./dev');
}


I've updated the env variable in the heroku app settings and double checked everything, those credentials are correct.



This is my Heroku log :



remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.15.0...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass@4.11.0 install
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-
sass/releases/download/v4.11.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.hFNmC/node-sass/4.11.0/linux-
x64-64_binding.node
remote:
remote: > node-sass@4.11.0 postinstall
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at
/tmp/build_e5f416e2f810c6ecc625fbcb71d64ab7/node_modules/node-
sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 305 packages from 198 contributors and audited 811
packages in 9.098s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 811 packages in 2.556s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 25.9M
remote: -----> Launching...
remote: Released v3
remote: https://vast-ridge-80091.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.


I've tried some solutions dicussed here : invalid_client in google oauth2



But still No luck.



Any kind of help will be a bliss.







javascript node.js heroku oauth-2.0 passport.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 at 6:10







MDIPANJAN

















asked Jan 19 at 6:05









MDIPANJANMDIPANJAN

217




217













  • Check the reply url in the google app

    – Max
    Jan 19 at 16:18











  • This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

    – MDIPANJAN
    Jan 19 at 19:09













  • The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

    – Max
    Jan 21 at 10:13



















  • Check the reply url in the google app

    – Max
    Jan 19 at 16:18











  • This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

    – MDIPANJAN
    Jan 19 at 19:09













  • The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

    – Max
    Jan 21 at 10:13

















Check the reply url in the google app

– Max
Jan 19 at 16:18





Check the reply url in the google app

– Max
Jan 19 at 16:18













This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

– MDIPANJAN
Jan 19 at 19:09







This is the reply url : accounts.google.com/o/oauth2/v2/… @Max

– MDIPANJAN
Jan 19 at 19:09















The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

– Max
Jan 21 at 10:13





The redirect_uri on the url you posted is: https://vast-ridge-80091.herokuapp.com/auth/google/callback is this correct for both remote and production ?

– Max
Jan 21 at 10:13












1 Answer
1






active

oldest

votes


















0














The reply url



https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback&scope=profile email&client_id=process.env.GOOGLE_CLIENT_ID


contains and error on client_id




client_id=process.env.GOOGLE_CLIENT_ID




You have to replace the process.env.GOOGLE_CLIENT_ID with the client_id






share|improve this answer
























  • Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

    – MDIPANJAN
    Jan 23 at 7:08













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54264515%2fgoogle-oauth2-0-showing-invalid-client-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The reply url



https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback&scope=profile email&client_id=process.env.GOOGLE_CLIENT_ID


contains and error on client_id




client_id=process.env.GOOGLE_CLIENT_ID




You have to replace the process.env.GOOGLE_CLIENT_ID with the client_id






share|improve this answer
























  • Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

    – MDIPANJAN
    Jan 23 at 7:08


















0














The reply url



https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback&scope=profile email&client_id=process.env.GOOGLE_CLIENT_ID


contains and error on client_id




client_id=process.env.GOOGLE_CLIENT_ID




You have to replace the process.env.GOOGLE_CLIENT_ID with the client_id






share|improve this answer
























  • Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

    – MDIPANJAN
    Jan 23 at 7:08
















0












0








0







The reply url



https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback&scope=profile email&client_id=process.env.GOOGLE_CLIENT_ID


contains and error on client_id




client_id=process.env.GOOGLE_CLIENT_ID




You have to replace the process.env.GOOGLE_CLIENT_ID with the client_id






share|improve this answer













The reply url



https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https://vast-ridge-80091.herokuapp.com/auth/google/callback&scope=profile email&client_id=process.env.GOOGLE_CLIENT_ID


contains and error on client_id




client_id=process.env.GOOGLE_CLIENT_ID




You have to replace the process.env.GOOGLE_CLIENT_ID with the client_id







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 21 at 10:26









MaxMax

3,67512240




3,67512240













  • Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

    – MDIPANJAN
    Jan 23 at 7:08





















  • Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

    – MDIPANJAN
    Jan 23 at 7:08



















Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

– MDIPANJAN
Jan 23 at 7:08







Actually the GOOGLE_CLIENT_ID is coming from the heroku, the environment variables and secrets are are saved into it . @Max

– MDIPANJAN
Jan 23 at 7:08




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54264515%2fgoogle-oauth2-0-showing-invalid-client-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Callistus III

Plistias Cous

Index Sanctorum