Fixes Backend OAuth2 Endpoint
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"allowedCommonJsDependencies": [
|
||||
"ts-interface-checker"
|
||||
],
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/manifest.webmanifest",
|
||||
@@ -73,10 +76,12 @@
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "frontend-hideyoshi.com:build:production"
|
||||
"browserTarget": "frontend-hideyoshi.com:build:production",
|
||||
"proxyConfig": "src/proxy.conf.json"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "frontend-hideyoshi.com:build:development"
|
||||
"browserTarget": "frontend-hideyoshi.com:build:development",
|
||||
"proxyConfig": "src/proxy.conf.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -26,6 +26,7 @@
|
||||
"@fortawesome/free-regular-svg-icons": "^6.1.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.1.1",
|
||||
"bootstrap": "^4.6.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.18.1",
|
||||
"jquery": "^3.6.0",
|
||||
"normalize.css": "^8.0.1",
|
||||
@@ -5828,7 +5829,6 @@
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
@@ -10584,7 +10584,6 @@
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -18611,7 +18610,6 @@
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
@@ -22109,8 +22107,7 @@
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.12.2",
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
"start": "node ./server.js",
|
||||
"postinstall": "ng build --configuration=production"
|
||||
},
|
||||
"proxy": {
|
||||
"/callback": {
|
||||
"target": "http://localhost:8070"
|
||||
}
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^14.0.3",
|
||||
@@ -24,6 +29,7 @@
|
||||
"@fortawesome/free-regular-svg-icons": "^6.1.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.1.1",
|
||||
"bootstrap": "^4.6.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.18.1",
|
||||
"jquery": "^3.6.0",
|
||||
"normalize.css": "^8.0.1",
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
const express = require('express');
|
||||
var cors = require('cors');
|
||||
const path = require('path');
|
||||
|
||||
const PKG_NAME = "frontend-hideyoshi.com";
|
||||
|
||||
const app = express();
|
||||
app.use(cors());
|
||||
|
||||
app.use(express.static(`${__dirname}/dist/${PKG_NAME}`));
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
.separator-line {
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
|
||||
@@ -18,6 +18,8 @@ export class AuthService {
|
||||
|
||||
readonly BACKEND_PATH = environment.backendPath;
|
||||
|
||||
readonly BACKEND_OAUTH_PATH = environment.backendOAuthPath;
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
login(userAuthAtempt: User): void {
|
||||
@@ -25,11 +27,11 @@ export class AuthService {
|
||||
}
|
||||
|
||||
googleLogin() {
|
||||
window.open(this.BACKEND_PATH + '/oauth2/authorization/google', '_self');
|
||||
window.open(this.BACKEND_OAUTH_PATH + '/oauth2/authorization/google', '_self');
|
||||
}
|
||||
|
||||
githubLogin() {
|
||||
window.open(this.BACKEND_PATH + '/oauth2/authorization/github', '_self');
|
||||
window.open(this.BACKEND_OAUTH_PATH + '/oauth2/authorization/github', '_self');
|
||||
}
|
||||
|
||||
loginGoogleUser(p: any): void {
|
||||
@@ -92,7 +94,7 @@ export class AuthService {
|
||||
);
|
||||
|
||||
return this.http.get<User>(
|
||||
this.BACKEND_PATH + '/login/oauth2/code/google',
|
||||
this.BACKEND_OAUTH_PATH + '/login/oauth2/code/google',
|
||||
{
|
||||
withCredentials: true,
|
||||
params: params
|
||||
@@ -111,7 +113,7 @@ export class AuthService {
|
||||
);
|
||||
|
||||
return this.http.get<User>(
|
||||
this.BACKEND_PATH + '/login/oauth2/code/github',
|
||||
this.BACKEND_OAUTH_PATH + '/login/oauth2/code/github',
|
||||
{
|
||||
withCredentials: true,
|
||||
params: params
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
backendPath: '/api'
|
||||
backendPath: '/api',
|
||||
backendOAuthPath: 'https://api.hideyoshi.com.br'
|
||||
};
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
backendPath: 'http://localhost:8070'
|
||||
backendPath: '/api',
|
||||
backendOAuthPath: 'http://localhost:8070'
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
7
src/proxy.conf.json
Normal file
7
src/proxy.conf.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "http://localhost:8070",
|
||||
"secure": false,
|
||||
"pathRewrite": {"^/api" : ""}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user