Skip to content

Commit

Permalink
Merge pull request #12 from viagogo/get-client-token-automatically
Browse files Browse the repository at this point in the history
Modified BearerAuthTokenHandler to get client token automatically
  • Loading branch information
akilburge committed Nov 23, 2015
2 parents b967a2e + da8c8ab commit a68c253
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1,027 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ bld/
[Oo]bj/
[Aa]rtifacts/

# Visual Studio cache directories
.vs/

# Roslyn cache directories
*.ide/

Expand Down
1,019 changes: 0 additions & 1,019 deletions .vs/config/applicationhost.config

This file was deleted.

4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### New in 0.5.0 (Releases 2015/11/23)
* BearerAuthenticationHandler gets a `client_credentials` token automatically if
the token store doesn't have a token yet

### New in 0.4.0 (Released 2015/06/16)
* Added WebhooksClient

Expand Down
8 changes: 4 additions & 4 deletions SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
[assembly: AssemblyProductAttribute("GogoKit")]
[assembly: AssemblyCompanyAttribute("viagogo")]
[assembly: AssemblyCopyrightAttribute("Copyright viagogo 2015")]
[assembly: AssemblyVersionAttribute("0.4.0")]
[assembly: AssemblyFileVersionAttribute("0.4.0")]
[assembly: AssemblyInformationalVersionAttribute("0.4.0")]
[assembly: AssemblyVersionAttribute("0.5.0")]
[assembly: AssemblyFileVersionAttribute("0.5.0")]
[assembly: AssemblyInformationalVersionAttribute("0.5.0")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.4.0";
internal const string Version = "0.5.0";
}
}
8 changes: 4 additions & 4 deletions src/GogoKit/Http/BearerTokenAuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ protected async override Task<HttpResponseMessage> SendAsync(
private async Task<OAuth2Token> GetTokenAsync()
{
var token = await _tokenStore.GetTokenAsync().ConfigureAwait(_configuration);
if (token == null || token.IssueDate.AddSeconds(token.ExpiresIn) > DateTime.UtcNow)
if (token != null && token.IssueDate.AddSeconds(token.ExpiresIn) > DateTime.UtcNow)
{
// We have a valid token or we don't have any token
// We have a valid token
return token;
}

// We have an expired token so refresh it
// We don't have a token or the token is expired - so refresh it
ApiException refreshTokenException = null;
try
{
if (token.RefreshToken != null)
if (token != null && token.RefreshToken != null)
{
token = await _oauthClient.RefreshAccessTokenAsync(token).ConfigureAwait(_configuration);
}
Expand Down
Binary file modified tools/nuget/NuGet.exe
Binary file not shown.

0 comments on commit a68c253

Please sign in to comment.