Forum Xamarin.Forms

Google Auth Error:disallowed_useragent

2»

Answers

  • ChiragDhawan.7833ChiragDhawan.7833 USMember
    edited June 2017

    I tried the ComicBook sample. With custom renderer, it shows my white blank page on iOS. Presenter is working fin. Any hint what I am missing, please?

  • moljacmoljac HRBeta ✭✭✭

    @ChiragDhawan.7833

    Xamarin.Forms Presenters implementation is tested a lot better than Custom Renderers. There were several fixes in 1.5.0.1 for Custom Renderers.

  • AhmadZeitounAhmadZeitoun USMember ✭✭
    edited June 2017

    Hi Guys,

    Real quick the account store is not storing the account information for IOS it works perfectly for android but for IOS it does not any clue why?

    Do i need to add anything additional for the Entitlement.plist or the Info.plist.

    [assembly: Dependency(typeof(CredentialService))]
    namespace MyNameSpaces.iOS
    {
    public class CredentialService: ICredentialService
    {
    public async Task<IEnumerable> FindRefreshTokensAsync()
    {
    var accounts = await AccountStore.Create().FindAccountsForServiceAsync(App.AppName);
    return accounts.Select(x => x.Properties["RefreshToken"]);
    }

        public async Task SaveRefreshTokenAsync(string refreshToken)
        {
            Account account = new Account();
    
            account.Properties.Add("RefreshToken", refreshToken);
            await AccountStore.Create().SaveAsync(account, App.AppName);
        }
    }
    

    }

    The code above works flawlessly for Android but for IOS it does not store the account information.

    Can someone please shine some insight

    Thank you!

  • AhmadZeitounAhmadZeitoun USMember ✭✭

    So after 12 hours of working this issue with the Simulator not storing the account information into the IOS keyChain
    this is what I concluded so far,
    it appears you need a provisioning profile which is done through Xcode which I created.
    But now it complains about the device not being found under the apple developer site.....
    Why cant they tell us if we can use a Simulator to test key chain features or not...
    This is why I hate Apple and All Apple products I mean its a god damn nightmare there documentation is so malformed and misleading.

    Does this mean I need a real device to store stuff into the IOS KeyChain or will the Simulator suffice =/

  • fenix2222fenix2222 AUMember ✭✭
    edited September 2017

    @moljak @EdHubbell I am still having troubles with Google Auth on iOS. Native browser opens fine, I can login to Google and Accept claims access. But then it never closes, just goes to google home page and Completed handler never gets called.

    I compared my solution to Evolve2016 sample and it looks very similar, not sure what I am missing.

    1. I definitely added CFBundleURLTypes into Info.plist including reverse google client id.
    2. I Double checked my redirect_uri and it is using "com.googleusercontent.apps.xxxxxxxxxx-xxxxxxxxxxxxx:/oauth2redirect format, i.e. no http or https in it
    3. I added "AppDelegate.OpenUrl.cs" as per sample all
    4. I am opening UI using this

    var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter(); presenter.Login(authenticator);

    I can't figure out what I am missing. Is this some kind of configuration issue in google console?

    Also, breakpoint in AppDelegate.OpenUrl.cs is hit, but nothing happens

    AuthenticationState.Authenticator.OnPageLoading(uri_netfx);

  • moljacmoljac HRBeta ✭✭✭

    @AhmadZeitoun

    Note about KeyChain and Simulator - it is Apple's bug and never was fixed.

    https://github.com/xamarin/Xamarin.Auth/blob/master/docs/details/ios-10.x-simulator-keychain-access-error.md

    HTH

  • moljacmoljac HRBeta ✭✭✭

    @fenix2222

    Pls go to community slack channel, so we can discuss it there in real time.

    All 4 steps look OK.

  • DhruvGohilDhruvGohil USMember ✭✭✭
    edited September 2017

    @moljac
    I have update all the nugets in android
    Google auhtentication works but it is not redirecting to the app(it redirects to www.google.com). Even does not call the Authenticator_Completed
    new Uri("com.demoapp.app:/oauth2redirect")

  • moljacmoljac HRBeta ✭✭✭

    @Dhruv

    redirect_url???

    AppDelegate.OpenUrl??

  • Narender_ReddyNarender_Reddy USMember ✭✭
    edited November 2019

    Hi,

    I am facing same issue all of the sudden in my android app. I am using Xamarin.Auth 1.6.0.4 version in my Xamarin.Forms(4.1) app.

    I am getting User Agent as "Mozilla/5.0 (Linux; Android 9; ONEPLUS A5010 Build/PKQ1.180716.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 Mobile Safari/537.36" from Xamarin.Auth.WebViewConfiguration.Android.UserAgent which I am setting to webView.Settings.UserAgentString.

    I tried editing user agent to "Mozilla/5.0 (Linux; Android 9; ONEPLUS A5010 Build/PKQ1.180716.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36" but no luck.

    Any help ?

Sign In or Register to comment.