Created
August 29, 2019 09:08
-
-
Save ntakouris/f5de047e5b59826c2f0aae2ab91626bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cachedToken = string.Empty; | |
var identityApi = RestService.For<IIdentityApi>("https://localhost:5001"); | |
var tweetbookApi = RestService.For<ITweetbookApi>("https://localhost:5001", new RefitSettings | |
{ | |
AuthorizationHeaderValueGetter = () => Task.FromResult(cachedToken) | |
}); | |
var registerResponse = await identityApi.RegisterAsync(new UserRegistrationRequest | |
{ | |
Email = "[email protected]", | |
Password = "Test1234!" | |
}); | |
var loginResponse = await identityApi.LoginAsync(new UserLoginRequest | |
{ | |
Email = "[email protected]", | |
Password = "Test1234!" | |
}); | |
cachedToken = loginResponse.Content.Token; | |
var allPosts = await tweetbookApi.GetAllAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment