403 Error: Disallowed_Useragent

Getting 403 disallowed_useragent on Azure B2C + Ionic Capacitor InAppBrowser google login

I solve it by adding the overrideUserAgent to the capacitor.config.json like this

  "cordova": {
"preferences": {
"OverrideUserAgent": "Mozilla/5.0 Google"
}
},

This object was added to the root of the file.

The problem is that Cordova preferences are added to capacitor preferences when we run cap init command, After that to add Cordova preferences we should use Cordova object inside capacitor.config.json as I did above.
https://capacitorjs.com/docs/cordova/migrating-from-cordova-to-capacitor#cordova-plugin-preferences

403 Error: disallowed_useragent

After Following Google drive API Quick start, Add these 3 lines of code in AppDelegate.m didFinishLaunchingWithOptions as Shown below.. then it works fine ...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

NSString *userAgent = @"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/603.1.23 (KHTML, like Gecko) Version/10.0 Mobile/14E5239e Safari/602";

// set default user agent

NSDictionary *dictionary = [[NSDictionary alloc]initWithObjectsAndKeys:userAgent,@"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:(dictionary)];

return YES;
}


Related Topics



Leave a reply



Submit