// Sample code for building a localized ApplicationBar //private void BuildLocalizedApplicationBar() //{ // // Set the page's ApplicationBar to a new instance of ApplicationBar. // ApplicationBar = new ApplicationBar(); // // Create a new button and set the text value to the localized string from AppResources. // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); // appBarButton.Text = AppResources.AppBarButtonText; // ApplicationBar.Buttons.Add(appBarButton); // // Create a new menu item with the localized string from AppResources. // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); // ApplicationBar.MenuItems.Add(appBarMenuItem); //} private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { if (_appSettings.Contains("authenticated")) { Oauth.Visibility = Visibility.Collapsed; UserDetails.Visibility = Visibility.Visible; } else { Oauth.VerifiedCodeReceived += async(s, ec) => { OAuth2Sample auth = s as OAuth2Sample; if (auth != null) { copyClient = await copyConfig.GetAccessTokenAsync(auth.VerifierCode); Dispatcher.BeginInvoke(new Action <CopyClient>(AfterAuthenticate), copyClient); } }; Scope scope = new Scope() { Profile = new ProfilePermission() { Read = true, Write = true } }; copyConfig = new Authentication.CopyAuth("http://copysdk", "cIAKv1kFCwXn2izGsMl8vZmfpfBcJSv1", "vNY1oLTr2WieLYxgCA6tDgdfCS1zTRA2IMzhmQLoQOS7nmIK", scope); await copyConfig.GetRequestTokenAsync(); Oauth.Visibility = Visibility.Visible; AuthenticateBtn.Visibility = Visibility.Collapsed; Oauth.GetVerifierCode(copyConfig.AuthCodeUri, new Uri(copyConfig.CallbackURL)); } }
public async Task <ActionResult> Authenticate() { Scope scope = new Scope() { Profile = new ProfilePermission() { Read = true, Write = true }, FileSystem = new FileSystemPermission() { Read = true, Write = true } }; Authentication.CopyAuth copyConfig = new Authentication.CopyAuth("http://localhost/CopyMVC/Home/About", "cIAKv1kFCwXn2izGsMl8vZmfpfBcJSv1", "vNY1oLTr2WieLYxgCA6tDgdfCS1zTRA2IMzhmQLoQOS7nmIK", scope); await copyConfig.GetRequestTokenAsync(); Session.Add("copyConfig", copyConfig); return(Redirect(copyConfig.AuthCodeUri.AbsoluteUri)); }
public async Task<ActionResult> Authenticate() { Scope scope = new Scope() { Profile = new ProfilePermission() { Read = true, Write = true }, FileSystem = new FileSystemPermission() { Read = true, Write = true } }; Authentication.CopyAuth copyConfig = new Authentication.CopyAuth("http://localhost/CopyMVC/Home/About", "cIAKv1kFCwXn2izGsMl8vZmfpfBcJSv1", "vNY1oLTr2WieLYxgCA6tDgdfCS1zTRA2IMzhmQLoQOS7nmIK", scope); await copyConfig.GetRequestTokenAsync(); Session.Add("copyConfig", copyConfig); return Redirect(copyConfig.AuthCodeUri.AbsoluteUri); }
// Sample code for building a localized ApplicationBar //private void BuildLocalizedApplicationBar() //{ // // Set the page's ApplicationBar to a new instance of ApplicationBar. // ApplicationBar = new ApplicationBar(); // // Create a new button and set the text value to the localized string from AppResources. // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); // appBarButton.Text = AppResources.AppBarButtonText; // ApplicationBar.Buttons.Add(appBarButton); // // Create a new menu item with the localized string from AppResources. // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); // ApplicationBar.MenuItems.Add(appBarMenuItem); //} private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { if (_appSettings.Contains("authenticated")) { Oauth.Visibility = Visibility.Collapsed; UserDetails.Visibility = Visibility.Visible; } else { Oauth.VerifiedCodeReceived += async (s, ec) => { OAuth2Sample auth = s as OAuth2Sample; if (auth != null) { copyClient = await copyConfig.GetAccessTokenAsync(auth.VerifierCode); Dispatcher.BeginInvoke(new Action<CopyClient>(AfterAuthenticate), copyClient); } }; Scope scope = new Scope() { Profile = new ProfilePermission() { Read = true, Write = true } }; copyConfig = new Authentication.CopyAuth("http://copysdk", "cIAKv1kFCwXn2izGsMl8vZmfpfBcJSv1", "vNY1oLTr2WieLYxgCA6tDgdfCS1zTRA2IMzhmQLoQOS7nmIK", scope); await copyConfig.GetRequestTokenAsync(); Oauth.Visibility = Visibility.Visible; AuthenticateBtn.Visibility = Visibility.Collapsed; Oauth.GetVerifierCode(copyConfig.AuthCodeUri, new Uri(copyConfig.CallbackURL)); } }