Skip to content

Commit 7bcf23d

Browse files
authored
Upgrade Facebook Graph API version to v22.0 (#59387)
1 parent bbe896f commit 7bcf23d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Security/Authentication/Facebook/src/FacebookDefaults.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ public static class FacebookDefaults
2424
/// <remarks>
2525
/// For more details about this endpoint, see <see href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#login"/>.
2626
/// </remarks>
27-
public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v14.0/dialog/oauth";
27+
public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v22.0/dialog/oauth";
2828

2929
/// <summary>
3030
/// The OAuth endpoint used to retrieve access tokens.
3131
/// </summary>
32-
public static readonly string TokenEndpoint = "https://graph.facebook.com/v14.0/oauth/access_token";
32+
public static readonly string TokenEndpoint = "https://graph.facebook.com/v22.0/oauth/access_token";
3333

3434
/// <summary>
3535
/// The Facebook Graph API endpoint that is used to gather additional user information.
3636
/// </summary>
37-
public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v14.0/me";
37+
public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v22.0/me";
3838
}

src/Security/Authentication/test/FacebookTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public async Task NestedMapWillNotAffectRedirect()
230230
var transaction = await server.SendAsync("http://example.com/base/login");
231231
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
232232
var location = transaction.Response.Headers.Location.AbsoluteUri;
233-
Assert.Contains("https://www.facebook.com/v14.0/dialog/oauth", location);
233+
Assert.Contains("https://www.facebook.com/v22.0/dialog/oauth", location);
234234
Assert.Contains("response_type=code", location);
235235
Assert.Contains("client_id=", location);
236236
Assert.Contains("redirect_uri=" + UrlEncoder.Default.Encode("http://example.com/base/signin-facebook"), location);
@@ -263,7 +263,7 @@ public async Task MapWillNotAffectRedirect()
263263
var transaction = await server.SendAsync("http://example.com/login");
264264
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
265265
var location = transaction.Response.Headers.Location.AbsoluteUri;
266-
Assert.Contains("https://www.facebook.com/v14.0/dialog/oauth", location);
266+
Assert.Contains("https://www.facebook.com/v22.0/dialog/oauth", location);
267267
Assert.Contains("response_type=code", location);
268268
Assert.Contains("client_id=", location);
269269
Assert.Contains("redirect_uri=" + UrlEncoder.Default.Encode("http://example.com/signin-facebook"), location);
@@ -298,7 +298,7 @@ public async Task ChallengeWillTriggerRedirection()
298298
var transaction = await server.SendAsync("http://example.com/challenge");
299299
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
300300
var location = transaction.Response.Headers.Location.AbsoluteUri;
301-
Assert.Contains("https://www.facebook.com/v14.0/dialog/oauth", location);
301+
Assert.Contains("https://www.facebook.com/v22.0/dialog/oauth", location);
302302
Assert.Contains("response_type=code", location);
303303
Assert.Contains("client_id=", location);
304304
Assert.Contains("redirect_uri=", location);
@@ -388,7 +388,7 @@ public async Task PkceSentToTokenEndpoint()
388388
{
389389
Sender = req =>
390390
{
391-
if (req.RequestUri.AbsoluteUri == "https://graph.facebook.com/v14.0/oauth/access_token")
391+
if (req.RequestUri.AbsoluteUri == "https://graph.facebook.com/v22.0/oauth/access_token")
392392
{
393393
var body = req.Content.ReadAsStringAsync().Result;
394394
var form = new FormReader(body);
@@ -407,7 +407,7 @@ public async Task PkceSentToTokenEndpoint()
407407
token_type = "Bearer",
408408
});
409409
}
410-
else if (req.RequestUri.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.UriEscaped) == "https://graph.facebook.com/v14.0/me")
410+
else if (req.RequestUri.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.UriEscaped) == "https://graph.facebook.com/v22.0/me")
411411
{
412412
return ReturnJsonResponse(new
413413
{
@@ -433,7 +433,7 @@ public async Task PkceSentToTokenEndpoint()
433433
var transaction = await server.SendAsync("https://example.com/challenge");
434434
Assert.Equal(HttpStatusCode.Redirect, transaction.Response.StatusCode);
435435
var locationUri = transaction.Response.Headers.Location;
436-
Assert.StartsWith("https://www.facebook.com/v14.0/dialog/oauth", locationUri.AbsoluteUri);
436+
Assert.StartsWith("https://www.facebook.com/v22.0/dialog/oauth", locationUri.AbsoluteUri);
437437

438438
var queryParams = QueryHelpers.ParseQuery(locationUri.Query);
439439
Assert.False(string.IsNullOrEmpty(queryParams["code_challenge"]));

0 commit comments

Comments
 (0)