NgExecutSocialLogin
This library was generated with Angular CLI version 12.1.0.
Atenção
Essa Biblioteca trabalha em conjunto com @datagrupo/ng-social-login e @angular/material.
Será necessário ter instalado em seu projeto tanto @datagrupo/ng-social-login quanto @angular/material
Sobre
Essa biblioteca tem como pretensão final facilitar a conexão do 'login' com a Google e microsoft.
Para isso, são abstraídos os principais providers, services e interceptors que são exigidos por cada plataforma.
Apos a instalação de todos os pacotes necessários, você precisará seguir algumas configurações:
Seu módulo de login
import {ConfigExternalLogin, ExecutSocialLoginModule, thirdPartyLoginAuthConfig} from "@datagrupo/ng-execut-social-login";
import {HttpClientModule} from "@angular/common/http";
import { SocialLoginModule } from '@datagrupo/ng-social-login';
const configExternalLogin: ConfigExternalLogin = {
apiUrl: 'url-do-seu-servidor',
googleClientId: 'id de cliente google',
redirectMicrosoft: 'link de redirecionamento microsoft(normalmente igual ao servidor)'
}
@NgModule({
imports: [
MatSnackBarModule,
ExecutSocialLoginModule.forRoot(configExternalLogin),
SocialLoginModule.initialize(thirdPartyLoginAuthConfig(environment.googleClientId))
],
...
})
export class AppModule { }
Seu componente de login
import {ExecutSocialLoginService} from "@datagrupo/ng-execut-social-login";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit{
constructor(private socialLogin: ExecutSocialLoginService) {
}
authenticateGoogle(){
this.socialLogin.signInWithGoogle().then((resp) => {
if (resp) {
if (resp.status) {
// recebimento de dados e continuidade do sistema
}
}
});
}
}
thirdPartyLoginAuthConfig(string)
A função thirdPartyLoginAuthConfig serve para facilitar a configuração do provider de login com o google.