watanabeyu / react-native-simple-twitter Goto Github PK
View Code? Open in Web Editor NEWTwitter API client for react native without react-native link and react custom hook
License: MIT License
Twitter API client for react native without react-native link and react custom hook
License: MIT License
Hi,
I'm getting the error while calling /oauth/request_token
api. I've done some console.log in the code.
uri: https://api.twitter.com/oauth/request_token
headers: {"headers": {"Authorization": "OAuth oauth_callback=https%3A%2F%appName.app, oauth_consumer_key=your_consumer/-key, oauth_nonce=qubNcG7rUP3MjQwxwxOmCtCiocLlkpkz, oauth_signature=uEaaVFVjbAITfZua91l%2FIsHOYtE%3D, oauth_signature_method=HMAC-SHA1, oauth_timestamp=1652179191.233, oauth_version=1.0"}, "method": "POST"}
response:
{"_bodyBlob": {"_data": {"__collector": [Object], "blobId": "E10BAB59-68BC-44D8-9F60-4080584B7AA3", "name": "request_token.html", "offset": 0, "size": 4078, "type": "text/html"}}, "_bodyInit": {"_data": {"__collector": [Object], "blobId": "E10BAB59-68BC-44D8-9F60-4080584B7AA3", "name": "request_token.html", "offset": 0, "size": 4078, "type": "text/html"}}, "bodyUsed": false, "headers": {"map": {"alt-svc": "h3=":443"; ma=2592000,h3-29=":443"; ma=2592000", "cache-control": "no-cache, no-store, max-age=0", "content-encoding": "gzip", "content-length": "1723", "content-security-policy": "default-src 'none'; img-src https://abs.twimg.com; script-src https://abs.twimg.com about:; style-src https://abs.twimg.com 'unsafe-inline'; font-src https://abs.twimg.com https://twitter.com; connect-src 'none'; object-src 'none'; media-src 'none'; frame-src 'none'; report-uri https://twitter.com/i/csp_report?a=ORTGK%3D%3D%3D&ro=false", "content-type": "text/html;charset=utf-8", "date": "Tue, 10 May 2022 10:39:51 UTC", "server": "tsa_k", "strict-transport-security": "max-age=631138519", "via": "1.1 google", "x-connection-hash": "72a9703d94498b092114f5d90dd45127ba542bf54d6d1784a6ae360b748ea308", "x-response-time": "178", "x-xss-protection": "0"}}, "ok": false, "status": 404, "statusText": "", "type": "default", "url": "https://api.twitter.com/oauth/request_token"}
Can you plz help me?
Thanks
After login the app only shows pin and not redirect back to my app. How to setup the apps.twitter.com?
Hey there @watanabeyu!
first, I want to thank you for making this amazing tool!
Such a breeze to use when you just want simple oauth.
We need to integrate with instagram as well and as I though this was a good starting point, I forked it and started making a instagram version of the package but then realized that maybe you already done it.
And behold, you did!
I see though that rn-simple-instagram is a tad dated and not up to date with this package. So I wonder if we should join forces and figure out how to make this package generic. Think about it as react-native-simple-oauth that works with multiple oauth provider.
What do you think?
After successfully login it doesn't back to app also onGetAccessToken functions is not called
I wanna go component2 when I login successed.
but this code not working in onSuccess.
but this work in onPress.
const resetAction = NavigationActions.reset({
index: 0,
key: null,
actions: [NavigationActions.navigate({ routeName: 'TabNavRoot' })],
});
this.props.navigation.dispatch(resetAction);
please teach me.
my navigation
StackNavigation
hi, i am using your package . if i am using in the ios this is working fine further more when i use android it is not giving any token and redirect
is there a way to use this package without exposing the consumer secret , maybe with a server side validation?
Hello,
I'm trying to implement twitter login with expo (SDK 41). I'm running into an error as soon as i call the useTwitter hook:
"Tried to register two views with the same name RNCWebView".
I understand this might be a version conflict between the webview used by the library (v8.2.1), and another webview used in my app (11.2.3).
Normally if react-native-webview is declared as a peerDepency in package.json of your lib, it should take my version of rn-webview, or am i mystaken ?
Thanks you in advance for any help you could give
When calling the account/verify_credentials.json endpoint, it returns an error 32 "could not authenticate you". In looking through the code, I believe it is due to the generated signature. When I use postman to make the request using OAuth 1.0 and fill in the required parameters, it generates a different signature in the OAuth authorization header and is successful. Any ideas? Could it be due to the way the crypto-js library is handling it?
i can't find a module to specify which twitter callback url to use.
as of my case i have another callback url in my twitter app dashboard to handle login in the browser.
When i try to run very basic example given in the readme doc, i am facing invalid hook call error.
My code is:
import { useEffect } from "react";
import { Text, View } from "react-native";
import { useTwitter } from "react-native-simple-twitter";
const TwitterSignin = () => {
const { twitter, TWModal, loggedInUser, accessToken } = useTwitter({
consumerKey: "my key",
consumerSecret: "my secret",
});
const onLoginPress = async () => {
try {
await twitter.login();
} catch (e) {
console.log(e.errors);
}
}
useEffect(() => {
console.log(loggedInUser)
}, [loggedInUser, accessToken]);
return (
<View>
<Text onPress={onLoginPress}>login</Text>
<TWModal />
</View>
)
}
export default TwitterSignin
react native version: 0.71.6
When I enter my username and password, a pin code appears in the screen, and I'm told to copy it and return to the application to complete authorization process.
Iguess that it could be because of my callback url. It is empty in twitter application manager. I don't know what to do (((
when I press login button webview appears, but there is a text which says that my accesstoken and secret kesys are invalid. And says to return from where I came.
Also, I can see that verify_credentials request int componentWillMount, responses error with code 32(could not authenticate). Idon't know what to do, please help.
I use Expo(create-react-native-app).
個人開発で使わせてもらっています。
Expo でサーバーを用意せずに Twitter ログインができるのでとても良いライブラリだと思っています。
issue については、タイトルの通りなのですが、Expo のバージョン 45 で TextInput に入力できない問題が発生しましたので、修正していただきたいです。
よろしくお願いします。
I use it for personal development.
I think it is a very good library because it allows me to log in to Twitter without having to prepare a server for Expo.
As for the issue, the title is correct, but there is a problem in Expo version 45 that prevents me from inputting text into TextInput.
Thank you very much.
can you provide an example of how to log the user in? In particular how to get a user's consumer key and consumer secret from the client side as seen here: https://github.com/watanabeyu/react-native-simple-twitter/blob/master/src/client.js#L22. Your example seems to assume the user is already logged in.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.