Update OAuth providers #4684 (#25112)

This commit is contained in:
Chris Ross 2020-08-23 17:04:43 -07:00 committed by GitHub
parent 112d821a26
commit e5ab127f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 13 deletions

View File

@ -10,10 +10,10 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
public static readonly string DisplayName = "Facebook";
// https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#login
public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v4.0/dialog/oauth";
public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v8.0/dialog/oauth";
public static readonly string TokenEndpoint = "https://graph.facebook.com/v4.0/oauth/access_token";
public static readonly string TokenEndpoint = "https://graph.facebook.com/v8.0/oauth/access_token";
public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v4.0/me";
public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v8.0/me";
}
}

View File

@ -14,10 +14,10 @@ namespace Microsoft.AspNetCore.Authentication.Google
public static readonly string DisplayName = "Google";
// https://developers.google.com/identity/protocols/OAuth2WebServer
// https://developers.google.com/identity/protocols/oauth2/web-server#httprest
public static readonly string AuthorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth";
public static readonly string TokenEndpoint = "https://www.googleapis.com/oauth2/v4/token";
public static readonly string TokenEndpoint = "https://oauth2.googleapis.com/token";
// https://developers.google.com/apis-explorer/#search/oauth2/oauth2/v2/
public static readonly string UserInformationEndpoint = "https://www.googleapis.com/oauth2/v2/userinfo";

View File

@ -110,7 +110,7 @@ namespace OpenIdConnectSample
o.Authority = Configuration["oidc:authority"];
*/
// https://github.com/IdentityServer/IdentityServer4.Demo/blob/master/src/IdentityServer4Demo/Config.cs
o.ClientId = "server.hybrid";
o.ClientId = "hybrid";
o.ClientSecret = "secret"; // for code flow
o.Authority = "https://demo.identityserver.io/";

View File

@ -117,7 +117,7 @@ namespace SocialSample
})
// You must first create an app with GitHub and add its ID and Secret to your user-secrets.
// https://github.com/settings/applications/
// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
// https://docs.github.com/en/developers/apps/authorizing-oauth-apps
.AddOAuth("GitHub", "Github", o =>
{
o.ClientId = Configuration["github:clientid"];
@ -156,7 +156,7 @@ namespace SocialSample
})
// You must first create an app with GitHub and add its ID and Secret to your user-secrets.
// https://github.com/settings/applications/
// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
// https://docs.github.com/en/developers/apps/authorizing-oauth-apps
.AddOAuth("GitHub-AccessToken", "GitHub AccessToken only", o =>
{
o.ClientId = Configuration["github-token:clientid"];
@ -171,9 +171,10 @@ namespace SocialSample
};
})
// https://demo.identityserver.io/
// https://github.com/IdentityServer/IdentityServer4.Demo/blob/master/src/IdentityServer4Demo/Config.cs
.AddOAuth("IdentityServer", "Identity Server", o =>
{
o.ClientId = "server.code";
o.ClientId = "interactive.public";
o.ClientSecret = "secret";
o.CallbackPath = new PathString("/signin-identityserver");
o.AuthorizationEndpoint = "https://demo.identityserver.io/connect/authorize";

View File

@ -233,7 +233,7 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
var transaction = await server.SendAsync("http://example.com/base/login");
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
var location = transaction.Response.Headers.Location.AbsoluteUri;
Assert.Contains("https://www.facebook.com/v4.0/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v8.0/dialog/oauth", location);
Assert.Contains("response_type=code", location);
Assert.Contains("client_id=", location);
Assert.Contains("redirect_uri=" + UrlEncoder.Default.Encode("http://example.com/base/signin-facebook"), location);
@ -266,7 +266,7 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
var transaction = await server.SendAsync("http://example.com/login");
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
var location = transaction.Response.Headers.Location.AbsoluteUri;
Assert.Contains("https://www.facebook.com/v4.0/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v8.0/dialog/oauth", location);
Assert.Contains("response_type=code", location);
Assert.Contains("client_id=", location);
Assert.Contains("redirect_uri=" + UrlEncoder.Default.Encode("http://example.com/signin-facebook"), location);
@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Authentication.Facebook
var transaction = await server.SendAsync("http://example.com/challenge");
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
var location = transaction.Response.Headers.Location.AbsoluteUri;
Assert.Contains("https://www.facebook.com/v4.0/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v8.0/dialog/oauth", location);
Assert.Contains("response_type=code", location);
Assert.Contains("client_id=", location);
Assert.Contains("redirect_uri=", location);

View File

@ -1020,7 +1020,7 @@ namespace Microsoft.AspNetCore.Authentication.Google
{
Sender = req =>
{
if (req.RequestUri.AbsoluteUri == "https://www.googleapis.com/oauth2/v4/token")
if (req.RequestUri.AbsoluteUri == "https://oauth2.googleapis.com/token")
{
return ReturnJsonResponse(new
{