Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Update facebook API version to 2.12 #1673

Merged
merged 1 commit into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public static class FacebookDefaults

public static readonly string DisplayName = "Facebook";

public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v2.6/dialog/oauth";
public static readonly string AuthorizationEndpoint = "https://www.facebook.com/v2.12/dialog/oauth";

public static readonly string TokenEndpoint = "https://graph.facebook.com/v2.6/oauth/access_token";
public static readonly string TokenEndpoint = "https://graph.facebook.com/v2.12/oauth/access_token";

public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v2.6/me";
public static readonly string UserInformationEndpoint = "https://graph.facebook.com/v2.12/me";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public async Task NestedMapWillNotAffectRedirect()
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/v2.6/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v2.12/dialog/oauth", location);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Assert using the constants?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way on that. There are pros/cons to using the fields vs. repeating the data.

Copy link
Member

@HaoK HaoK Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but in this case isn't it basically always a bug if these ever are inconsistent since we are exposing this in our Defaults class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pros to using const's:

  • Less work to maintain because you make the change in one place

Cons to using const's:

  • Less clear when you make a src change to see what effect it has on the product

So, yes, it'd be a bug if it's inconsistent, and this test would tell you that, and you have to fix it (of course). Using a const would avoid the need to have to change the test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But mainly the upside is it makes future updates trivial, as its just updating the constant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that's why I'm fine either way 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually prefer updating it separately in the tests. It's like having to enter your e-mail address twice to confirm you did it right.

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);
Expand Down Expand Up @@ -617,7 +617,7 @@ public async Task MapWillNotAffectRedirect()
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/v2.6/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v2.12/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);
Expand Down Expand Up @@ -652,7 +652,7 @@ public async Task ChallengeWillTriggerRedirection()
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/v2.6/dialog/oauth", location);
Assert.Contains("https://www.facebook.com/v2.12/dialog/oauth", location);
Assert.Contains("response_type=code", location);
Assert.Contains("client_id=", location);
Assert.Contains("redirect_uri=", location);
Expand Down