GoldenOwlAsia / react-native-twitter-signin

MIT License
167 stars 303 forks source link

Error: Twitter signin error #17 #205

Closed AlbertJohanson closed 7 months ago

AlbertJohanson commented 7 months ago

Hello, I am trying to use react-native-twitter-signin /twitter-signin, I did the entire installation procedure but every time I call the logIn() method I get the following error Screenshot 2023-11-30 at 00 42 59

I checked the issues of the original repo but nothing I have tried has worked so far, the callback url is fine in the app's config in the Twitter developer portal, and the configurations in the info.plist, the Consumers keys are the correct so I don't understand what causes this error, could someone help me?

import React, {useContext, useState} from 'react';
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native';

import RNTwitterSignIn from '@react-native-twitter-signin/twitter-signin';

//assets
const logo = require('../../assets/images/Logo.png');

const Constants = {
  TWITTER_COMSUMER_KEY: 'WDDjgCyhTrGfx2ZXmGfHNJQMc',
  TWITTER_CONSUMER_SECRET: 'lpTfrdDfrb7Tb7pwxTz0qqyvyW7jmpnNhMH7jiXeOJIp9Xfvsz',
};

const MyChildren = () => {

  const twitterSignIn = () => {
    console.log(Constants.TWITTER_COMSUMER_KEY)
    console.log(Constants.TWITTER_CONSUMER_SECRET)
    RNTwitterSignIn.init(Constants.TWITTER_COMSUMER_KEY, Constants.TWITTER_CONSUMER_SECRET);
    RNTwitterSignIn.logIn()
      .then((loginData: any) => {
        console.log(loginData);
      })
  };

  return (
    <View style={{flex: 1, backgroundColor: '#FFF'}}>
            <IsConnecteBtn
              name="Twitter(X)"
              icon="https://about.twitter.com/content/dam/about-twitter/x/brand-toolkit/logo-black.png.twimg.1920.png"
              socialMedia={childInfo.socialMedia?.twitter}
              handleConnectSocialMedia={twitterSignIn}
            />

    </View>
  );
};

export default MyChildren;
<key>CFBundleURLSchemes</key>
            <array>
                <string>fb************</string>
                <string>twitterkit-Vk4xAsBgoR3EUmOZuyJMnk0vT</string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>FacebookAppID</key>
    <string>*****************************</string>
    <key>FacebookClientToken</key>
    <string>*********************</string>
    <key>FacebookDisplayName</key>
    <string>PrePost</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>twitter</string>
        <string>twitterauth</string>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>

Screenshot 2023-11-30 at 00 57 08

Brioni commented 7 months ago

The same issue: await RNTwitterSignIn.logIn() > [Error: Twitter signin error]

developer1031 commented 6 months ago

@AlbertJohanson @Brioni Hello. Did you solve the problem? In detail the error message is

failed to retrieve credential when connecting your account please try again by tapping the connect button