次のコードを使用して、MVC Webアプリケーションからトークンを取得しています。しかし、私が追加した主張をどのように取り出すのかは分かりません。彼らは私のトークンと同じ応答で返されるべきですか? ありがとう!ASP.Net MVC 6のOAuth認証サービスからクレームを取得する
Startup.cs:
app.UseJwtBearerAuthentication(options =>
{
options.AutomaticAuthenticate = true;
options.Audience = "resource_server";
options.Authority = "https://www.example.com/";
options.RequireHttpsMetadata = false;
});
app.UseOpenIdConnectServer(options =>
{
options.ApplicationCanDisplayErrors = true;
options.AllowInsecureHttp = false;
options.Provider = new AuthorizationProvider();
options.TokenEndpointPath = "/connect/token";
});
主張を追加:あなたはid_token
との両方を指定しているので
{"resource":"resource_server","scope":"openid profile","token_type":"bearer","access_token":"eyJhbGciOiJSU....","expires_in":"3600"}
なぜあなたは 'User.FindFirst(" custom_claim ")を使わないのですか? –
私のクライアントは、私がasp.net Userオブジェクトを持っていないと思うXamarin iOS/Androidアプリです。私はoauthのログインをしていると私のアプリでトークンとクレームを維持しています。 – Primico