public void SignIn() { var url = NSUrl.FromString(AuthUrl); var callbackScheme = "exampleauth"; var session = new ASWebAuthenticationSession(url, callbackScheme, (callbackUrl, error) => { if (error != null) { // TODO: Handle error return; } if (callbackUrl == null) { // TODO: Handle error return; } // The callback URL format depends on the provider. For this example: // exampleauth://auth?token=1234 var queryItems = NSUrlComponents.FromString(callbackUrl.AbsoluteString).QueryItems; var token = queryItems?.FirstOrDefault(x => x.Name == "token")?.Value; // TODO: Check token }) { PresentationContextProvider = _presentationContext }; session.Start(); }
private async void GetScan(object s, object e) { ZXing.Mobile.MobileBarcodeScanner scanner = new ZXing.Mobile.MobileBarcodeScanner(); ZXing.Result result = await scanner.Scan(); if (result == null) { return; } Console.WriteLine("Scanned Barcode: " + result.Text); NSUrlComponents comps = NSUrlComponents.FromString(result.Text); if (comps != null && comps.QueryItems != null) { foreach (NSUrlQueryItem queryItem in comps.QueryItems) { if (queryItem.Name == "code") { var suppress = GetAndOpenActivity(queryItem.Value); return; } } } AppUtils.ShowSimpleDialog(this, "Not found", "Are you sure that was a valid OurPlace QR code?", "Got it"); }