- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我似乎无法理解为什么我会从 IdentityServer 获得 unauthorized_client。我将 oidc-client 与 Angular 4 ui 和 Web API 的 asp.net 核心一起使用。我无法连接到身份服务器,因为每次它返回时我的客户端都是 unauthorized_client
。
这是注册客户端:
new Client
{
ClientId = "EStudent",
ClientName = "EStudent",
AllowedGrantTypes = GrantTypes.Implicit,
RequireClientSecret = false,
AllowAccessTokensViaBrowser = true,
AllowedCorsOrigins = { "http://localhost:63150" },
LogoutSessionRequired = false,
RequireConsent = false,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"UsersAPI",
},
AlwaysIncludeUserClaimsInIdToken = true,
RedirectUris = {
"http://localhost:63150/oauth.html"
},
PostLogoutRedirectUris = {
"http://localhost:63150/",
$"{this._baseAddress}/index.html"
},
AllowOfflineAccess = true,
}
这是 Angular 中的授权服务:
import { Injectable, EventEmitter } from '@angular/core';
import { Http, Headers, RequestOptions, Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { UserManager, User } from 'oidc-client';
import { environment } from '../../../environments/environment';
const settings: any = {
authority: 'http://localhost:8200/oauth',
client_id: 'EStudent',
redirect_uri: 'http://localhost:63150/auth.html',
post_logout_redirect_uri: 'http://localhost:63150/index.html',
response_type: 'id_token token',
scope: 'openid profile UsersAPI',
silent_redirect_uri: 'http://localhost:63150/silent-renew.html',
automaticSilentRenew: true,
accessTokenExpiringNotificationTime: 4,
// silentRequestTimeout:10000,
filterProtocolClaims: true,
loadUserInfo: true
};
@Injectable()
export class AuthService {
mgr: UserManager = new UserManager(settings);
userLoadededEvent: EventEmitter<User> = new EventEmitter<User>();
currentUser: User;
loggedIn = false;
authHeaders: Headers;
constructor(private http: Http) {
this.mgr.getUser().then((user) => {
if (user) {
this.loggedIn = true;
this.currentUser = user;
this.userLoadededEvent.emit(user);
} else {
this.loggedIn = false;
}
}).catch((err) => {
this.loggedIn = false;
});
this.mgr.events.addUserLoaded((user) => {
this.currentUser = user;
this.loggedIn = !(user === undefined);
if (!environment.production) {
console.log('authService addUserLoaded', user);
}
});
this.mgr.events.addUserUnloaded((e) => {
if (!environment.production) {
console.log('user unloaded');
}
this.loggedIn = false;
});
}
}
最后我像这样调用 identityserver:
constructor(public oidcSecurityService: AuthService) { }
ngOnInit() {
this.oidcSecurityService.mgr.signinRedirect();
}
发送的请求如下所示:
http://localhost:8200/oauth/connect/authorize?client_id=EStudent&redirect_uri=http%3A%2F%2Flocalhost%3A63150%2Fauth.html&response_type=id_token%20token&scope=openid%20profile%20UsersAPI&state=91ea5de6886a49a997704bbdb4beda0c&nonce=295e6bf737274ea18ee2f575c93d150b
最佳答案
您的 IdentityServer Client
有一个 redirectUri
与请求中使用的不匹配:
http://localhost:63150/oauth.html
在请求中,您使用以下内容,它缺少 oauth
中的 o
:
http://localhost:63150/auth.html
关于c# - Identityserver 隐式流 unauthorized_client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46537043/
我正在使用“Google_Client”类来验证对 adwords api 的访问权限,因此: $REDIRECT_URI = 'http://localhost/GoogleAdwords/auth
我似乎无法理解为什么我会从 IdentityServer 获得 unauthorized_client。我将 oidc-client 与 Angular 4 ui 和 Web API 的 asp.ne
在我的 IS4 的 Startup.cs 中: services.AddAuthentication() .AddMicrosoftAccount(o => {
在我的 IS4 的 Startup.cs 中: services.AddAuthentication() .AddMicrosoftAccount(o => {
我已经配置了 Azure AD B2C 应用程序,但当我运行该应用程序时出现上述主题错误,可能是什么原因。 Error. An error occurred while processing your
我正在撰写有关如何使用 Postman 从 IDS4 获取 token 的演示。 密码 token 请求取自IDS4's page . [HttpGet("token")] public IActio
尝试刷新访问 token 时出现错误: 400 Bad Request {error : "unauthorized_client"} 从 Google token URI: { "error"
我正在尝试在 nodejs 应用程序上使用 Oauth 和 nodemailer 发送邮件,我在没有 Oauth 的情况下做到了,但我的密码是在代码中写的,所以我转向了 Oauth。 我只想连接自己以
我已经设置身份服务器 4 来扩展 Umbraco,因此它使用自定义角色提供程序。 一切正常,但现在当我被重定向到我的身份服务器时,我收到了这个错误: 任何人都可以阐明这个错误吗?我曾尝试在源代码管理中
在我工作的地方,我们使用 Google Apps for Work。在过去的 9 个月中,我们一直在使用 Gmail API(每天约 2,000 个请求)为我们的支持电子邮件帐户提取新电子邮件。 这是
按照此处提供的步骤 https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app 在
这是我的 mvc 与身份服务器连接的初始设置。 app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
我尝试在Python中访问OAuth2(代码与 http://code.google.com/p/google-api-ads-python/source/browse/trunk/examples/
我们正在尝试构建一项服务,以在我们的 gsuite 域中导出 google drive 文件。 我们正在使用 https://github.com/google/google-api-php-clie
我需要注册我的应用程序才能使用 Outlook 日历 API。我在这里创建了应用程序:https://apps.dev.microsoft.com 。我有应用程序 ID 和重定向 URI。然后我使用以
我正在尝试使用代码 ( https://developers.docusign.com/platform/auth/authcode/authcode-get-token ) 使用 DocuSign
我需要注册我的应用程序才能使用 Outlook 日历 API。我在这里创建了应用程序:https://apps.dev.microsoft.com 。我有应用程序 ID 和重定向 URI。然后我使用以
我正在尝试使用代码 ( https://developers.docusign.com/platform/auth/authcode/authcode-get-token ) 使用 DocuSign
我正在尝试将 Google 云端硬盘服务添加到我的 Objective-C 应用中,但收到: Domain=com.google.HTTPStatus Code=400 "The operation
编辑:错误发生在这段代码上: var gmail = google.gmail('v1'); gmail.users.labels.list({ auth: auth
我是一名优秀的程序员,十分优秀!