是的,abp.io支持“使用Google登录”按钮。在abp.io中,您可以使用IdentityServer插件来实现此功能。您需要做的是在IdentityServer的配置文件(appsettings.json)中添加Google作为身份验证提供程序,并在您的前端代码中使用Google按钮。以下是一个示例:
1.在IdentityServer的配置文件(appsettings.json)中添加Google作为身份验证提供程序
"IdentityServer": {
"Clients": {
//...其他客户端配置
"MyClient": {
//...其他客户端配置
"ClientId": "my_client_id",
"ClientSecrets": [{
"Value": "my_client_secret"
}],
"AllowedGrantTypes": [ "client_credentials", "authorization_code", "implicit", "password" ],
"RedirectUris": [ "https://localhost:4200/signin-oidc" ],
"PostLogoutRedirectUris": [ "https://localhost:4200/signout-callback-oidc" ],
"AllowedScopes": [ "openid", "profile", "my_api" ]
}
},
"IdentityProviders": {
"Google": {
"ClientId": "my_google_client_id",
"ClientSecret": "my_google_client_secret"
}
}
}
2.在前端代码中使用Google按钮来登录
import { Component, OnInit } from '@angular/core';
import { AuthService } from '@abp/ng.core';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
constructor(private authService: AuthService) { }
ngOnInit(): void {
}
startGoogleLogin() {
this.authService.redirectToProvider('Google');
}
}