public async Task Revoke_LegacyToken() { var authClient = new FortnoxAuthClient(); var authWorkflow = authClient.StaticTokenAuthWorkflow; var accessToken = Guid.NewGuid().ToString(); var success = await authWorkflow.RevokeTokenAsync(accessToken); Assert.IsTrue(success); }
public async Task Test_StaticTokenAuth_GetToken() { var clientSecret = TestCredentials.Client_Secret; var authorizationCode = "ca7f0830-ccf1-63f8-f750-1f78f50c0d58"; var fortnoxAuthClient = new FortnoxAuthClient(); var authWorkflow = fortnoxAuthClient.StaticTokenAuthWorkflow; var token = await authWorkflow.GetTokenAsync(authorizationCode, clientSecret); Assert.IsNotNull(token); }
public async Task Revoke_RefreshToken() { var authClient = new FortnoxAuthClient(); var authWorkflow = authClient.StandardAuthWorkflow; var refreshToken = TestUtils.RandomString(40); var clientId = "pTFDdCGfhv9a"; var clientSecret = "xcvtLzVjVs"; var success = await authWorkflow.RevokeRefreshTokenAsync(refreshToken, clientId, clientSecret); Assert.IsTrue(success); }
public async Task Test_StandardAuth_GetToken() { var clientId = "8VurtMGDTeAI"; //"bhgmY4FYebfj"; var clientSecret = "yFKwme8LEQ"; //"TestCredentials.Client_Secret; var redirectUri = "https://mysite.org/activation"; var authorizationCode = "Placeholder"; var fortnoxAuthClient = new FortnoxAuthClient(); var authWorkflow = fortnoxAuthClient.StandardAuthWorkflow; var token = await authWorkflow.GetTokenAsync(authorizationCode, clientId, clientSecret, redirectUri); Assert.IsNotNull(token); }
public void Test_BuildUri_Example() { var clientId = "8VurtMGDTeAI"; var clientSecret = "yFKwme8LEQ"; var redirectUri = "https://mysite.org/activation"; var scopes = new List <Scope>() { Scope.CompanyInformation }; var state = "somestate123"; var fortnoxAuthClient = new FortnoxAuthClient(); var authWorkflow = fortnoxAuthClient.StandardAuthWorkflow; var uri = authWorkflow.BuildAuthUri(clientId, scopes, state, redirectUri); Assert.AreEqual(@"https://apps.fortnox.se/oauth-v1/auth?client_id=8VurtMGDTeAI&redirect_uri=https%3A%2F%2Fmysite.org%2Factivation&scope=companyinformation&state=somestate123&access_type=offline&response_type=code", uri.AbsoluteUri); }