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

Commit 0fee3c8

Browse files
committed
#85 - Update the targeted Facebook API version to v2.2.
1 parent 8709721 commit 0fee3c8

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<DevelopmentServerPort>54539</DevelopmentServerPort>
67
</PropertyGroup>
78
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
89
<PropertyGroup Label="Globals">
@@ -11,4 +12,4 @@
1112
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
1213
</PropertyGroup>
1314
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
14-
</Project>
15+
</Project>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<DevelopmentServerPort>54541</DevelopmentServerPort>
67
</PropertyGroup>
78
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
89
<PropertyGroup Label="Globals">
@@ -11,4 +12,4 @@
1112
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
1213
</PropertyGroup>
1314
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
14-
</Project>
15+
</Project>
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<DevelopmentServerPort>54540</DevelopmentServerPort>
7+
<CommandLineArguments />
8+
<DebugTarget />
69
</PropertyGroup>
710
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
811
<PropertyGroup Label="Globals">
@@ -11,4 +14,4 @@
1114
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
1215
</PropertyGroup>
1316
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
14-
</Project>
17+
</Project>

samples/SocialSample/Startup.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void Configure(IApplicationBuilder app)
3737
options.LoginPath = new PathString("/login");
3838
});
3939

40+
// https://developers.facebook.com/apps/
4041
app.UseFacebookAuthentication(options =>
4142
{
4243
options.AppId = "569522623154478";
@@ -55,31 +56,33 @@ public void Configure(IApplicationBuilder app)
5556
options.Scope.Add("email");
5657
});
5758

59+
// https://console.developers.google.com/project
5860
app.UseGoogleAuthentication(options =>
5961
{
6062
options.ClientId = "560027070069-37ldt4kfuohhu3m495hk2j4pjp92d382.apps.googleusercontent.com";
6163
options.ClientSecret = "n2Q-GEw9RQjzcRbU3qhfTj8f";
6264
});
6365

66+
// https://apps.twitter.com/
6467
app.UseTwitterAuthentication(options =>
6568
{
6669
options.ConsumerKey = "6XaCTaLbMqfj6ww3zvZ5g";
6770
options.ConsumerSecret = "Il2eFzGIrYhz6BWjYhVXBPQSfZuS4xoHpSSyD9PI";
6871
});
6972

70-
/*
71-
The MicrosoftAccount service has restrictions that prevent the use of http://localhost:12345/ for test applications.
72-
As such, here is how to change this sample to uses http://mssecsample.localhost.this:12345/ instead.
73+
/* https://account.live.com/developers/applications
74+
The MicrosoftAccount service has restrictions that prevent the use of http://localhost:54540/ for test applications.
75+
As such, here is how to change this sample to uses http://mssecsample.localhost.this:54540/ instead.
7376
74-
Edit the Project.json file and replace http://localhost:12345/ with http://mssecsample.localhost.this:12345/.
77+
Edit the Project.json file and replace http://localhost:54540/ with http://mssecsample.localhost.this:54540/.
7578
7679
From an admin command console first enter:
7780
notepad C:\Windows\System32\drivers\etc\hosts
7881
and add this to the file, save, and exit (and reboot?):
7982
127.0.0.1 MsSecSample.localhost.this
8083
8184
Then you can choose to run the app as admin (see below) or add the following ACL as admin:
82-
netsh http add urlacl url=http://mssecsample.localhost.this:12345/ user=[domain\user]
85+
netsh http add urlacl url=http://mssecsample.localhost.this:54540/ user=[domain\user]
8386
8487
The sample app can then be run via:
8588
k web
@@ -102,6 +105,7 @@ k web
102105
options.ClientSecret = "bLw2JIvf8Y1TaToipPEqxTVlOeJwCUsr";
103106
});
104107

108+
// https://github.com/settings/applications/
105109
app.UseOAuthAuthentication("GitHub-AccessToken", options =>
106110
{
107111
options.ClientId = "8c0c5a572abe8fe89588";

samples/SocialSample/project.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"Kestrel": "1.0.0-*"
1212
},
1313
"commands": {
14-
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:12345",
15-
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
14+
/* Note all servers must use the same address and port because these are pre-registered with the various providers. */
15+
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:54540",
16+
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:54540"
1617
},
1718
"frameworks": {
1819
"aspnet50": {

src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationDefaults.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public static class FacebookAuthenticationDefaults
77
{
88
public const string AuthenticationType = "Facebook";
99

10-
public const string AuthorizationEndpoint = "https://www.facebook.com/dialog/oauth";
10+
public const string AuthorizationEndpoint = "https://www.facebook.com/v2.2/dialog/oauth";
1111

12-
public const string TokenEndpoint = "https://graph.facebook.com/oauth/access_token";
12+
public const string TokenEndpoint = "https://graph.facebook.com/v2.2/oauth/access_token";
1313

14-
public const string UserInformationEndpoint = "https://graph.facebook.com/me";
14+
public const string UserInformationEndpoint = "https://graph.facebook.com/v2.2/me";
1515
}
1616
}

test/Microsoft.AspNet.Security.Test/Facebook/FacebookMiddlewareTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public async Task ChallengeWillTriggerRedirection()
9797
var transaction = await SendAsync(server, "http://example.com/challenge");
9898
transaction.Response.StatusCode.ShouldBe(HttpStatusCode.Redirect);
9999
var location = transaction.Response.Headers.Location.AbsoluteUri;
100-
location.ShouldContain("https://www.facebook.com/dialog/oauth");
100+
location.ShouldContain("https://www.facebook.com/v2.2/dialog/oauth");
101101
location.ShouldContain("response_type=code");
102102
location.ShouldContain("client_id=");
103103
location.ShouldContain("redirect_uri=");

0 commit comments

Comments
 (0)