Commit 9e831a37 authored by CarlosGC1989's avatar CarlosGC1989
Browse files

Arregla error con ruta oauth

parent e803dfea
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ var express = require('express'),
	request = require('request');

var params, app, version,
	oauthClientSecret = process.env.OAUTH_CLIENT_SECRET || 'secret';
	publicHostname = process.env.PUBLIC_HOSTNAME,
	oauthClientSecret = process.env.OAUTH_CLIENT_SECRET;

function getLang(req) {

@@ -90,9 +91,6 @@ function onUnknownRequest(req, res, next) {
function onOauthTokenRequest(req, res) {

	var query = req.query,
		headers = req.headers,
		protocol = headers['x-forwarded-proto'],
		host = headers.host,

		clientId = query.clientid,
		password = query.password,
@@ -101,7 +99,7 @@ function onOauthTokenRequest(req, res) {
		clientCredentials = clientId + ':' + oauthClientSecret,
		base64ClientCredentials = Buffer.from(clientCredentials).toString('base64'),

		url = protocol + '://' + host + '/api/oauth/token',
		url = publicHostname + '/api/oauth/token',
		authorization = 'Basic ' + base64ClientCredentials,
		body = "grant_type=password&username=" + username + "&password=" + password + "&scope=write",