public async Task TestRefreshAuthToken() { // Try describe without being authenticated, expect 401 Assert.AreEqual(HttpStatusCode.Unauthorized, await DoDescribe(null)); // Get auth token (through refresh) var loginOptions = new LoginOptions(TestCredentials.LOGIN_URL, TestCredentials.CLIENT_ID, null, null); AuthResponse refreshResponse = OAuth2.RefreshAuthTokenRequest(loginOptions, TestCredentials.REFRESH_TOKEN).Result; // Try describe again, expect 200 Assert.AreEqual(HttpStatusCode.Ok, await DoDescribe(refreshResponse.AccessToken)); }
public void TestCallIdentityService() { // Get auth token and identity url (through refresh) var loginOptions = new LoginOptions(TestCredentials.LOGIN_URL, TestCredentials.CLIENT_ID, null, null); AuthResponse refreshResponse = OAuth2.RefreshAuthTokenRequest(loginOptions, TestCredentials.REFRESH_TOKEN).Result; // Call the identity service IdentityResponse identityResponse = OAuth2.CallIdentityService(refreshResponse.IdentityUrl, refreshResponse.AccessToken).Result; // Check username Assert.AreEqual("*****@*****.**", identityResponse.UserName); }