Skip to content

Commit

Permalink
Fixed issues connecting to peloton authentication API
Browse files Browse the repository at this point in the history
  • Loading branch information
cabird committed Sep 19, 2019
1 parent 4d43b58 commit 05a74b8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
5 changes: 2 additions & 3 deletions PelotonData.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2046
# Visual Studio Version 16
VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PelotonData", "PelotonData\PelotonData.csproj", "{08C3882F-9669-4C82-A005-1BE8657732B7}"
EndProject
Expand All @@ -28,7 +28,6 @@ Global
{AC76E67D-6BA5-4E83-B07C-92669A68B2F1}.Debug|Any CPU.ActiveCfg = Debug
{AC76E67D-6BA5-4E83-B07C-92669A68B2F1}.Release|Any CPU.ActiveCfg = Release
{0D4FCDED-D5EA-4D27-B887-4E8C8F9037D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D4FCDED-D5EA-4D27-B887-4E8C8F9037D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D4FCDED-D5EA-4D27-B887-4E8C8F9037D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D4FCDED-D5EA-4D27-B887-4E8C8F9037D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
Expand Down
9 changes: 8 additions & 1 deletion PelotonData/PelotonDataDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,20 @@ async Task RunAsync(string username, string password)

public async Task<AuthResponse> AuthenticateAsync(string user, string password, ILogger logger, string SaveJsonPath=null)
{
string authURL = "https://api.pelotoncycle.com/auth/login";
string authURL = "https://api.onepeloton.com/auth/login";
var info = new { password = password, username_or_email = user };
string infoAsString = JsonConvert.SerializeObject(info);

using (var client = new WebClient())
{
client.Headers[HttpRequestHeader.ContentType] = "application/json";

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


var responseTask = client.UploadStringTaskAsync(authURL, infoAsString);
string response = await responseTask;

Expand Down
9 changes: 4 additions & 5 deletions PelotonData/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PelotonData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Peloton Data Download Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Christian Bird")]
[assembly: AssemblyProduct("PelotonData")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
3 changes: 2 additions & 1 deletion PelotonDataGui/PelotonDataGui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>0.1.0.%2a</ApplicationVersion>
<ApplicationVersion>1.0.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand All @@ -48,6 +48,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WindowsAPICodePack-Core.1.1.1\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
Expand Down
5 changes: 2 additions & 3 deletions PelotonDataGui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Christian Bird")]
[assembly: AssemblyProduct("Peloton Data Download Utility")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down Expand Up @@ -51,5 +50,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]

0 comments on commit 05a74b8

Please sign in to comment.