Skip to content

Commit

Permalink
fix: Change token name GOOGLE_CONFIG_TOKEN => GOOGLE_PLUS_CONFIG_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
EndyKaufman committed Aug 6, 2018
1 parent 1f82105 commit 1f3e7de
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/libs/auth/configs/google-plus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const defaultGooglePlusConfig: IGooglePlusConfig = {
],
grant_type: 'authorization_code'
};
export const GOOGLE_CONFIG_TOKEN: string = 'GooglePlusConfig';
export const GOOGLE_PLUS_CONFIG_TOKEN: string = 'GooglePlusConfig';
4 changes: 2 additions & 2 deletions src/libs/auth/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '../configs/facebook.config';
import {
defaultGooglePlusConfig,
GOOGLE_CONFIG_TOKEN
GOOGLE_PLUS_CONFIG_TOKEN
} from '../configs/google-plus.config';
import { defaultJwtConfig, JWT_CONFIG_TOKEN } from '../configs/jwt.config';

Expand All @@ -18,7 +18,7 @@ export const configs = [
useValue: defaultFacebookConfig
},
{
provide: GOOGLE_CONFIG_TOKEN,
provide: GOOGLE_PLUS_CONFIG_TOKEN,
useValue: defaultGooglePlusConfig
}
];
4 changes: 2 additions & 2 deletions src/libs/auth/passport/google-plus.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Inject, Injectable, Logger } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { use } from 'passport';
import * as GoogleTokenStrategy from 'passport-google-plus-token';
import { GOOGLE_CONFIG_TOKEN } from '../configs/google-plus.config';
import { GOOGLE_PLUS_CONFIG_TOKEN } from '../configs/google-plus.config';
import { RegisterDto } from '../dto/register.dto';
import { OauthTokensAccesstoken } from '../entities/oauth-tokens-accesstoken.entity';
import { IGooglePlusConfig } from '../interfaces/google-plus-config.interface';
Expand All @@ -12,7 +12,7 @@ import { OauthTokensAccesstokensService } from '../services/oauth-tokens-accesst
@Injectable()
export class GooglePlusStrategy {
constructor(
@Inject(GOOGLE_CONFIG_TOKEN)
@Inject(GOOGLE_PLUS_CONFIG_TOKEN)
private readonly googlePlusConfig: IGooglePlusConfig,
private readonly oauthTokensAccesstokensService: OauthTokensAccesstokensService,
private readonly authService: AuthService
Expand Down
14 changes: 7 additions & 7 deletions src/libs/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { plainToClass } from 'class-transformer';
import { stringify } from 'querystring';
import { map } from 'rxjs/operators';
import { FACEBOOK_CONFIG_TOKEN } from '../configs/facebook.config';
import { GOOGLE_CONFIG_TOKEN } from '../configs/google-plus.config';
import { GOOGLE_PLUS_CONFIG_TOKEN } from '../configs/google-plus.config';
import { LoginDto } from '../dto/login.dto';
import { RedirectUriDto } from '../dto/redirect-uri.dto';
import { RegisterDto } from '../dto/register.dto';
Expand All @@ -31,7 +31,7 @@ export class AuthService {
constructor(
@Inject(CORE_CONFIG_TOKEN) private readonly coreConfig: ICoreConfig,
@Inject(FACEBOOK_CONFIG_TOKEN) private readonly fbConfig: IFacebookConfig,
@Inject(GOOGLE_CONFIG_TOKEN)
@Inject(GOOGLE_PLUS_CONFIG_TOKEN)
private readonly googlePlusConfig: IGooglePlusConfig,
private readonly httpService: HttpService,
private readonly usersService: UsersService,
Expand All @@ -40,7 +40,7 @@ export class AuthService {
if (this.coreConfig.externalPort) {
this.url = `${this.coreConfig.protocol}://${this.coreConfig.domain}:${
this.coreConfig.externalPort
}`;
}`;
} else {
this.url = `${this.coreConfig.protocol}://${this.coreConfig.domain}`;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ export class AuthService {
throw new ConflictException(
`User with email "${options.email}" is exists`
);
} catch (error) {}
} catch (error) { }
}
if (options.username) {
try {
Expand All @@ -87,7 +87,7 @@ export class AuthService {
throw new ConflictException(
`User with username "${options.username}" is exists`
);
} catch (error) {}
} catch (error) { }
}
const group = this.groupsService.getGroupByName({ name: 'user' });
const newUser = await plainToClass(User, options).setPassword(
Expand All @@ -104,7 +104,7 @@ export class AuthService {
];
const redirect_uri: string = `${
this.fbConfig.login_dialog_uri
}?${queryParams.join('&')}`;
}?${queryParams.join('&')}`;
Logger.log(redirect_uri, AuthService.name + ':requestFacebookRedirectUri');
return {
redirect_uri
Expand Down Expand Up @@ -168,7 +168,7 @@ export class AuthService {
];
const redirect_uri: string = `${
this.googlePlusConfig.login_dialog_uri
}?${queryParams.join('&')}`;
}?${queryParams.join('&')}`;
Logger.log(redirect_uri, AuthService.name + ':requestGoogleRedirectUri');
return {
redirect_uri
Expand Down
6 changes: 3 additions & 3 deletions src/main.hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
JWT_CONFIG_TOKEN,
IGooglePlusConfig,
defaultGooglePlusConfig,
GOOGLE_CONFIG_TOKEN
GOOGLE_PLUS_CONFIG_TOKEN
} from '@rucken/auth-nestjs';
import {
appFilters,
Expand Down Expand Up @@ -39,7 +39,7 @@ async function bootstrap() {
accessSync(`.env`);
config();
Logger.log(`env file: .env`, 'Main');
} catch (error) {}
} catch (error) { }
}
const coreConfig: ICoreConfig = {
...defaultCoreConfig,
Expand Down Expand Up @@ -76,7 +76,7 @@ async function bootstrap() {
{ provide: CORE_CONFIG_TOKEN, useValue: coreConfig },
{ provide: JWT_CONFIG_TOKEN, useValue: jwtConfig },
{ provide: FACEBOOK_CONFIG_TOKEN, useValue: facebookConfig },
{ provide: GOOGLE_CONFIG_TOKEN, useValue: googlePlusConfig },
{ provide: GOOGLE_PLUS_CONFIG_TOKEN, useValue: googlePlusConfig },
...appFilters,
...appPipes
]
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
JWT_CONFIG_TOKEN,
IGooglePlusConfig,
defaultGooglePlusConfig,
GOOGLE_CONFIG_TOKEN
GOOGLE_PLUS_CONFIG_TOKEN
} from '@rucken/auth-nestjs';
import {
appFilters,
Expand All @@ -37,7 +37,7 @@ async function bootstrap() {
accessSync(`.env`);
config();
Logger.log(`env file: .env`, 'Main');
} catch (error) {}
} catch (error) { }
}
const coreConfig: ICoreConfig = {
...defaultCoreConfig,
Expand Down Expand Up @@ -74,7 +74,7 @@ async function bootstrap() {
{ provide: CORE_CONFIG_TOKEN, useValue: coreConfig },
{ provide: JWT_CONFIG_TOKEN, useValue: jwtConfig },
{ provide: FACEBOOK_CONFIG_TOKEN, useValue: facebookConfig },
{ provide: GOOGLE_CONFIG_TOKEN, useValue: googlePlusConfig },
{ provide: GOOGLE_PLUS_CONFIG_TOKEN, useValue: googlePlusConfig },
...appFilters,
...appPipes
]
Expand Down

0 comments on commit 1f3e7de

Please sign in to comment.