public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental"); global::Xamarin.Forms.Forms.Init(); LoadApplication(new T()); bool result = base.FinishedLaunching(app, options); OktaContext.Init(new OidcClient(Window.RootViewController, OktaConfig.LoadFromPList("OktaConfig.plist"))); return(result); }
public ProfileViewModel(ProfilePage profilePage) { this.Page = profilePage; if (Instance == null) { Instance = this; } ; this.StateManager = OktaContext.Current.StateManager; OktaContext.AddSignInCompletedListener(OnSignInCompleted); OktaContext.AddSignOutCompletedListener(OnSignOutCompleted); }
protected override void OnCreate(Bundle savedInstanceState) { OktaContext.Init(new OidcClient(this, OktaConfig.LoadFromXmlStream(Assets.Open("OktaConfig.xml")))); // TODO: change this to use .AddSignXXXCompletedListener methods. OktaContext.Current.SignInCompleted += (sender, args) => Shell.Current.GoToAsync("//ProfilePage"); OktaContext.Current.SignOutCompleted += (sender, args) => Shell.Current.GoToAsync("//ProfilePage"); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new OktaApp()); }
public void RaiseSignInEventsOnSignIn() { OidcClient client = new OidcClient(new OktaConfig("testoktaid", "https://dev-00000.oktapreview.com", "com.test:/redirect", "com.test:/logout")); OktaContext.Init(client); bool?signInStartedEventRaised = false; bool?signInCompletedEventRaised = false; OktaContext.AddSignInStartedListener((sender, eventArgs) => signInStartedEventRaised = true); OktaContext.AddSignInCompletedListener((sender, eventArgs) => signInCompletedEventRaised = true); OktaContext.Current.SignIn(); client.CurrentTask_Accessor.SetResult(new OktaState("testAccessToken", "testTokenType", "testIdToken", "testRefreshToken")); Assert.True(signInStartedEventRaised); Assert.True(signInCompletedEventRaised); }