-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting "Cannot retrieve OAuth Client credentials: undefined" when configuring at some arbitrary ports #3234
Comments
Hello, You should run the command in |
Thanks. This indeed fixed the errors npm gave me, meanwhile the issue remains. Any ideas why I still get that error? What does it mean? What should I try to change in the "webserver" section? |
What is your instance URL? |
Hi @Chocobozzz I installed your software two days ago, and got the same problem. "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.oauthClientsRouter = void 0;
const tslib_1 = require("tslib");
const express = require("express");
const logger_1 = require("../../helpers/logger");
const config_1 = require("../../initializers/config");
const middlewares_1 = require("../../middlewares");
const oauth_client_1 = require("../../models/oauth/oauth-client");
const oauthClientsRouter = express.Router();
exports.oauthClientsRouter = oauthClientsRouter;
oauthClientsRouter.get('/local', middlewares_1.asyncMiddleware(getLocalClient));
function getLocalClient(req, res, next) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const serverHostname = config_1.CONFIG.WEBSERVER.HOSTNAME;
const serverPort = config_1.CONFIG.WEBSERVER.PORT;
let headerHostShouldBe = serverHostname;
// #### I COMMENTED THIS BLOCK ####
/*if (serverPort !== 80 && serverPort !== 443) {
headerHostShouldBe += ':' + serverPort;
}*/
if (process.env.NODE_ENV !== 'test' && req.get('host') !== headerHostShouldBe) {
logger_1.logger.info('Getting client tokens for host %s is forbidden (expected %s).', req.get('host'), headerHostShouldBe);
return res.type('json').status(403).end();
}
const client = yield oauth_client_1.OAuthClientModel.loadFirstClient();
if (!client)
throw new Error('No client available.');
const json = {
client_id: client.clientId,
client_secret: client.clientSecret
};
return res.json(json);
});
} My 2 cents. Hope it will be useful for someone in future |
@ilgiaco What is your instance URL? |
I'm currently using https://myinstance.com:1234 |
Hello @Chocobozzz, I hope I may apologize for the late reply. My instance URL is (due to my arbitrary port) https://domain.tld:4443. Like @ilgiaco I do not feel to share it publicly as it is at the moment for private testing only. Thanks @ilgiaco for the hint, I'll test your fix soon. |
Then, make sure you use |
Of course I configured the respective port in "production.yaml" as already and initially described above. Moreover I don't exactly understand why this issue was closed as it could be reproduced by someone else in the meantime with similiar intention namely using nonstandard ports. |
@ilgiaco , thanks ! worked for me with same issue ! but i just entered the dif. port i do use for my instance :) http 8080 /s 4443 |
Hello; what a great project! When testing on some arbitrary port, I get the following warning:
I configured everything else like in the documentation described (except the standard ports), so my configuration differs as follows:
/var/www/peertube/config/production.yaml:
/etc/nginx/sites-enabled/peertube:
My syslog prints the following meaningful regarding the problem:
Oct 28 14:07:11 localhost peertube[18140]: [peertube.$DOMAIN:4443] 2020-10-28 14:07:11.694 #33[33mwarn#033[39m: It seems PeerTube was started (and created some data) with another domain name. This means you
will not be able to federate! Please use NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host to fix this.
When I proceed like told I get:
npm ERR! path /var/www/peertube/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/var/www/peertube/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
Just a quick sidenote: when changing the 2 configs above to standard ports, everything works fine. Meanwhile I used this aproach as I have already apache listening on 80 and 443 and did not felt to migrate the nginx vhost config to apache or migrate my other vhosts to nginx. ; )
The text was updated successfully, but these errors were encountered: