Merge pull request #4 from HideyoshiNakazone/devel

Fixes Backend OAuth2 Endpoint
This commit is contained in:
2022-11-11 04:57:17 -03:00
committed by GitHub
5 changed files with 21 additions and 8 deletions

View File

@@ -76,10 +76,12 @@
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "frontend-hideyoshi.com:build:production" "browserTarget": "frontend-hideyoshi.com:build:production",
"proxyConfig": "src/proxy.conf.json"
}, },
"development": { "development": {
"browserTarget": "frontend-hideyoshi.com:build:development" "browserTarget": "frontend-hideyoshi.com:build:development",
"proxyConfig": "src/proxy.conf.json"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"

View File

@@ -18,6 +18,8 @@ export class AuthService {
readonly BACKEND_PATH = environment.backendPath; readonly BACKEND_PATH = environment.backendPath;
readonly BACKEND_OAUTH_PATH = environment.backendOAuthPath;
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
login(userAuthAtempt: User): void { login(userAuthAtempt: User): void {
@@ -25,11 +27,11 @@ export class AuthService {
} }
googleLogin() { googleLogin() {
window.open(this.BACKEND_PATH + '/oauth2/authorization/google', '_self'); window.open(this.BACKEND_OAUTH_PATH + '/oauth2/authorization/google', '_self');
} }
githubLogin() { githubLogin() {
window.open(this.BACKEND_PATH + '/oauth2/authorization/github', '_self'); window.open(this.BACKEND_OAUTH_PATH + '/oauth2/authorization/github', '_self');
} }
loginGoogleUser(p: any): void { loginGoogleUser(p: any): void {
@@ -92,7 +94,7 @@ export class AuthService {
); );
return this.http.get<User>( return this.http.get<User>(
this.BACKEND_PATH + '/login/oauth2/code/google', this.BACKEND_OAUTH_PATH + '/login/oauth2/code/google',
{ {
withCredentials: true, withCredentials: true,
params: params params: params
@@ -111,7 +113,7 @@ export class AuthService {
); );
return this.http.get<User>( return this.http.get<User>(
this.BACKEND_PATH + '/login/oauth2/code/github', this.BACKEND_OAUTH_PATH + '/login/oauth2/code/github',
{ {
withCredentials: true, withCredentials: true,
params: params params: params

View File

@@ -1,4 +1,5 @@
export const environment = { export const environment = {
production: true, production: true,
backendPath: '/api' backendPath: '/api',
backendOAuthPath: 'https://api.hideyoshi.com.br'
}; };

View File

@@ -4,7 +4,8 @@
export const environment = { export const environment = {
production: false, production: false,
backendPath: 'http://localhost:8070' backendPath: '/api',
backendOAuthPath: 'http://localhost:8070'
}; };
/* /*

7
src/proxy.conf.json Normal file
View File

@@ -0,0 +1,7 @@
{
"/api": {
"target": "http://localhost:8070",
"secure": false,
"pathRewrite": {"^/api" : ""}
}
}