Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Token changes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdeafcafe committed Apr 28, 2020
1 parent 9e1165a commit 6e7eb51
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions dotnet/Services/Token/App/GetXblToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ await Task.WhenAll(
{
CacheInfo = new CacheInfo(token.IssueInstant, token.NotAfter),
Token = token.Token,
Uhs = token.DisplayClaims.Xui[0].Uhs,
};

client.Set(XblRedisKey, JsonConvert.SerializeObject(response), (DateTime) response.CacheInfo.ExpiresAt);
Expand Down
28 changes: 28 additions & 0 deletions dotnet/Services/Token/Client.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Branch.Global.Contracts;
using Branch.Global.Libraries;
using Microsoft.AspNetCore.Http;

namespace Branch.Services.Token
{
public class TokenClient : ITokenService
{
private JsonClient _client { get; }

public TokenClient(string baseUrl, string key)
{
var options = new HttpClientOptions
{
Headers = new Dictionary<string, string> { { "Authorization", $"bearer {key}" } },
};

_client = new JsonClient(baseUrl, options);
}

public async Task<GetXblTokenResponse> GetXblToken(HttpContext ctx, GetTokenRequest req)
{
return await _client.Do<GetXblTokenResponse>("POST", "1/2020-04-27/get_xbl_token", req);
}
}
}
3 changes: 2 additions & 1 deletion dotnet/Services/Token/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ BaseURL: https://service-token.branch.golf/1
"cached_at": "2020-04-26T23:00:02.168Z",
"expires_at": "2020-04-26T23:15:13.614Z"
},
"token": "blah blah"
"token": "blah blah",
"uhs": "blah"
}
```

2 changes: 2 additions & 0 deletions dotnet/Services/Token/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public class GetXblTokenResponse : IBranchResponse
public CacheInfo CacheInfo { get; set; }

public string Token { get; set; }

public string Uhs { get; set; }
}
}

0 comments on commit 6e7eb51

Please sign in to comment.