public async System.Threading.Tasks.Task LogsOnManyWays() { { // :code-block-start: logon_anon var user = await app.LogInAsync(Credentials.Anonymous()); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { // :code-block-start: logon_EP var user = await app.LogInAsync( Credentials.EmailPassword("*****@*****.**", "shhhItsASektrit!")); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { var apiKey = "F5ONly653MyQEq781wR4LT3nu3eGmIf0uDhHnkpsAkXyvsbPee8RqJyv6HVzM9dU"; // :code-block-start: logon_API var user = await app.LogInAsync(Credentials.ApiKey(apiKey)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { // :code-block-start: logon_Function var functionParameters = new { username = "******", password = "******", IQ = 42, isCool = false }; var user = await app.LogInAsync(Credentials.Function(functionParameters)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { var jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." + "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6ImNhbGViQGV4YW1wbGUuY29tIiwiaWF0IjoxNjAxNjc4ODcyLCJleHAiOjI1MTYyMzkwMjIsImF1ZCI6InNuaXBwZXRzZG9ub3RkZWxldGUtcXJvdXEifQ." + "Qp-sRcKAyuS5ONeBDvZuSg6-YAzohCdU3yKLnz7MXbI"; // :code-block-start: logon_JWT var user = await app.LogInAsync(Credentials.JWT(jwt_token)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } try { var facebookToken = ""; // :code-block-start: logon_fb var user = await app.LogInAsync(Credentials.Facebook(facebookToken)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-facebook' is unsupported", e.Message); } try { var googleAuthCode = ""; // :code-block-start: logon_google var user = await app.LogInAsync(Credentials.Google(googleAuthCode, GoogleCredentialType.AuthCode)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-google' is unsupported", e.Message); } try { var appleToken = ""; // :code-block-start: logon_apple var user = await app.LogInAsync(Credentials.Apple(appleToken)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-apple' is unsupported", e.Message); } }
public async System.Threading.Tasks.Task LogsOnManyWays() { { // :code-block-start: logon_anon var user = await app.LogInAsync(Credentials.Anonymous()); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { // :code-block-start: logon_EP var user = await app.LogInAsync( Credentials.EmailPassword("*****@*****.**", "shhhItsASektrit!")); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { var apiKey = "eRECwv1e6gkLEse99XokWOgegzoguEkwmvYvXk08zAucG4kXmZu7TTgV832SwFCv"; // :code-block-start: logon_API var user = await app.LogInAsync(Credentials.ApiKey(apiKey)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { // :code-block-start: logon_Function var functionParameters = new { username = "******", password = "******", IQ = 42, isCool = false }; var user = await app.LogInAsync(Credentials.Function(functionParameters)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } { var jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkNhbGViIiwiaWF0IjoxNjAxNjc4ODcyLCJleHAiOjI1MTYyMzkwMjIsImF1ZCI6InR1dHMtdGlqeWEifQ.LHbeSI2FDWrlUVOBxe-rasuFiW-etv2Gu5e3eAa6Y6k"; // :code-block-start: logon_JWT var user = await app.LogInAsync(Credentials.JWT(jwt_token)); // :code-block-end: Assert.AreEqual(UserState.LoggedIn, user.State); await user.LogOutAsync(); } try { var facebookToken = ""; // :code-block-start: logon_fb var user = await app.LogInAsync(Credentials.Facebook(facebookToken)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-facebook' is unsupported", e.Message); } try { var googleAuthCode = ""; // :code-block-start: logon_google var user = await app.LogInAsync(Credentials.Google(googleAuthCode, GoogleCredentialType.AuthCode)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-google' is unsupported", e.Message); } try { var appleToken = ""; // :code-block-start: logon_apple var user = await app.LogInAsync(Credentials.Apple(appleToken)); // :code-block-end: } catch (Exception e) { Assert.AreEqual("InvalidSession: authentication via 'oauth2-apple' is unsupported", e.Message); } }