Search code examples
androidfirebaseandroid-studiofirebase-authenticationtwitter-oauth

Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings what to do?


Pic of twtter developers app site

So my problem is I am getting this weird error message from the title of my question and I really don´t know why. I have took the oAuth url that firebase authentification provided me and pasted into the twitter app developers site in the callback url field. So why is it telling me that I need to register it ?

Posted my code here if it is for some reason my code that has to do with it:

twitterRealButton.setCallback(new Callback<TwitterSession>() {
                    @Override
                    public void success(Result<TwitterSession> result) {
                        Toast.makeText(LoginActivity.this, "Signed in to twitter successful", Toast.LENGTH_LONG).show();
                        handleTwitterSignIn(result.data);

                    }

                    @Override
                    public void failure(TwitterException exception) {
                        Toast.makeText(LoginActivity.this, "Login failed. No internet or No Twitter app found on your phone", Toast.LENGTH_LONG).show();

                    }
                });
                twitterRealButton.performClick();
}

 private void handleTwitterSignIn(TwitterSession session){
        AuthCredential credential = TwitterAuthProvider.getCredential(session.getAuthToken().token,
                session.getAuthToken().secret);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Toast.makeText(LoginActivity.this, "Signed in firebase twitter successful", Toast.LENGTH_LONG).show();
                        if (!task.isSuccessful()){
                            Toast.makeText(LoginActivity.this, "Auth firebase twitter failed", Toast.LENGTH_LONG).show();
                        }
                    }
                });
    }

Solution

  • Ok this is really weird and I don´t know why this has worked but for some reason if you add: twittersdk:// as your callback url it works I guess ?