Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead

restapi
android
oauth

#1

Since January 1st, we have had many Android users report that they cannot login using twitter because they get the following error. We were able to reproduce it, but not consistently. The only error logs I am able to find are “Error parsing a meta element’s content: ‘;’ is not a valid key-value pair separator. Please use ‘,’ instead.”. Has anyone experienced this issue? Google searches suggest this has always been an intermittent twitter api error. Is there a workaround?


#2

Error parsing a meta element’s content: ‘;’ is not a valid key-value pair separator. Please use ‘,’ instead.


#3

Are you using Twitter Kit in Fabric, or some other mechanism?


#4

No, just using the rest api


#5

Are you using any specific Twitter client library? Can you share an code samples? Do you have any sense of the frequency this occurs?


#6

We are not using any specific Twitter client library. For the rest api, we are using Retrofit and OkHttp libraries, but OAuth is happening in a standard Android WebView. The Twitter code is actually quite old; it hasn’t been updated in a while:

Intent i = new Intent(this, OAuthHelperWebView.class);
i.putExtra(OAuthHelperWebView.INTENT_EXTRA_KEY_OAUTH_CALLBACK_URL, OAUTH_CALLBACK_URL);
i.putExtra(OAuthHelperWebView.INTENT_EXTRA_KEY_OAUTH_URL, oAuthUrl);
startActivityForResult(i, OAuthHelperWebView.REQUEST_CODE);

package sample;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import java.lang.reflect.InvocationTargetException;

import sample.R;

@SuppressLint("SetJavaScriptEnabled")
public class OAuthHelperWebView extends Activity {
	static final public String INTENT_EXTRA_KEY_OAUTH_URL = "intent_extra_key_url";
	static final public String INTENT_EXTRA_KEY_OAUTH_CALLBACK_URL = "intent_extra_key_oauth_url";

	static final public String RESULT_INTENT_KEY_ERROR_MSG = "result_intent_key_error_msg";
	static final public String RESULT_INTENT_KEY_CALLBACK_URL = "result_intent_key_callback_url";

	static final public int RESULT_CODE_CANCELLED = 0;
	static final public int RESULT_CODE_OK = 1;
	static final public int RESULT_CODE_ERROR = 2;

	static final public int REQUEST_CODE = 1000;

	static final public String DEFAULT_OAUTH_CALLBACK_URL = "http://web_message";

	private WebView mWebView = null;
	private String oauthCallbackUrl = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_webview);

		mWebView = (WebView) findViewById(R.id.webview);

		mWebView.getSettings().setJavaScriptEnabled(true);
		mWebView.setWebChromeClient(new WebChromeClient());
		mWebView.setWebViewClient(new WebViewClient() {
			@Override
			public void onPageFinished(WebView view, String url) {
				if (url.startsWith(oauthCallbackUrl)) {
					Intent i = new Intent();
					i.putExtra(RESULT_INTENT_KEY_CALLBACK_URL, url);
					setResult(RESULT_CODE_OK, i);
					finish();
				} else {
					super.onPageFinished(view, url);
				}
			}
		});

		Intent extras = getIntent();
		oauthCallbackUrl = extras.getStringExtra(INTENT_EXTRA_KEY_OAUTH_CALLBACK_URL);
		if (oauthCallbackUrl == null)
			oauthCallbackUrl = DEFAULT_OAUTH_CALLBACK_URL;

		String url = extras.getStringExtra(INTENT_EXTRA_KEY_URL);
		if (url == null) {
			Intent errorIntent = createErrorIntent("url missing");
			setResult(RESULT_CODE_ERROR, errorIntent);
			finish();
			return;
		} else {
			mWebView.loadUrl(url);
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		callWebKitFunction("onResume");
	}

	@Override
	protected void onPause() {
		callWebKitFunction("onPause");
		super.onPause();
	}

	@Override
	public void onBackPressed() {
		mWebView.stopLoading();
		setResult(RESULT_CODE_CANCELLED);
		finish();
	}

	private void callWebKitFunction(String function) {
		try {
			Class.forName("android.webkit.WebView")
					.getMethod(function, (Class[]) null)
					.invoke(this.mWebView, (Object[]) null);
		} catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | NoClassDefFoundError | NoSuchMethodException e) {
			e.printStackTrace();
		}
	}

	private Intent createErrorIntent(String msg) {
		Intent errorIntent = new Intent();
		errorIntent.putExtra(RESULT_INTENT_KEY_ERROR_MSG, msg);
		return errorIntent;
	}
}

As for frequency, we are still getting more information, but we have been getting several reports a day from our users.


#7

I am also getting the same error. I am using compile ‘com.parse:parsetwitterutils-android:1.10.5’ .Please help.


#8

This sounds like it might be a bug in the Parse Twitter library.


#9

It appears to happen in any implementation for Android. I came here through a search for the error using Twitter4j. How is every library getting the same error if it is a big with the libraries?