Guest User

Untitled

a guest
Jan 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. services.AddIdentityServer()
  2. //.AddDeveloperSigningCredential()
  3. .AddSigningCredential(Certificate.GetCertificate())
  4. .AddInMemoryIdentityResources(Config.GetIdentityResources())
  5. .AddInMemoryApiResources(Config.GetApiResources())
  6. .AddInMemoryClients(Config.GetClients())
  7. .AddTestUsers(Config.GetUsers());
  8.  
  9. new Client
  10. {
  11. ClientId = "client",
  12. ClientName = "client",
  13. ClientSecrets =
  14. {
  15. new Secret("secret".Sha256())
  16. },
  17. RequireClientSecret = false,
  18. RedirectUris = new List<string>(new string[] { "https://www.getpostman.com/oauth2/callback", "http://localhost:8002", "http://192.168.1.5:8002","app.buyingagent:/oauthredirect"}),
  19. AllowedGrantTypes = GrantTypes.Code,
  20. //RequirePkce = true,
  21. AllowedScopes = { "api" },
  22. AllowOfflineAccess = true
  23. }
  24.  
  25. public static X509Certificate2 GetCertificate()
  26. {
  27. using (var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine))
  28. {
  29. store.Open(OpenFlags.OpenExistingOnly);
  30. var certs = store.Certificates.Find(X509FindType.FindBySubjectName, "cert", false);
  31. return certs.Count > 0 ? certs[0] : null;
  32. }
  33. }
  34.  
  35. POST http://{url}/connect/token
  36. Request Headers:
  37. undefined:undefined
  38. Request Body:
  39. grant_type:"authorization_code"
  40. code:"7cb58d345975af02332f2b67cb71958ba0a48c391e34edabd0d9dd1500e3f24e"
  41. redirect_uri:"https://identity.buyingagentapp.com/connect/token"
  42. client_id:"client"
  43. Response Headers:
  44. undefined:undefined
  45. Response Body:
  46. error:"invalid_grant"
  47. invalid_grant
  48. Error
Add Comment
Please, Sign In to add comment