Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How can I change a WebView user-agent?

$
0
0

Hi everybody!

I'm trying to make an hybrid app for my current webapp in Xamarin.Forms Portable App, I'm creating a ContentPage Class with a custom WebView object like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace MyHybridApp
{
public class Navigator : ContentPage
{
public Navigator()
{
WebView visor = new WebView()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Source = "{URL_to_my_webapp_social_login}"
};
Content = visor;
}
}
}

The problem is that, when I open the app and try to login in my webapp using Google OAuth, Google give me this error:

**403. That's an error.

Error: disallowed_useragent

Google can't sign you safely inside this app.
You can use Google sign-in by visiting this app's website in a browser like Safari or Chrome.**

Can anybody help me to avoid that? The User-Agent can be changed on a WebView? And, How can I do that?

Thanks a lot!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>