Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-simple-twitter
Advanced tools
Twitter API client for React Native without react-native link
TWLoginButton
/ twitter.get()
/ twitter.post()
will be removed on next version (v3.1.0).Twitter API client for React Native without react-native link
.
This package don't use NativeModule, only pure javascript.
So don't need to use react-native link
and Expo can also easily use twitter API without auth0 and server.
You can use custom hooks from v3.0
twitter.switch()
を用意loggedInUser
,accessToken
} = useTwitter()とした方が使いやすい気がする(useEffect
で監視できる)twitter.setAccessToken()
をしたらloggedInUser
をアップデートするために自動でaccountを持ってくるuseTwitter({consumerKey,consumerSecret})
で初期化できるようにするloggedInUserが同じ値だとEffectしないのをどうするか?
did not receive response to shouldstartload in time defaulting to yes
...
import { useTwitter } from "react-native-simple-twitter";
function Login() {
// if login, please set onSuccess
const { twitter, TWModal, loggedInUser, accessToken } = useTwitter({
consumerKey:"key",
consumerSecret:"secret",
});
const onLoginPress = async () => {
try {
await twitter.login();
} catch(e) {
console.log(e.errors);
}
}
useEffect(() => {
},[loggedInUser, accessToken]);
...
return (
<View>
<Text onPress={onLoginPress}>login</Text>
<TWModal />
</View>
)
}
Checkout v3.x example.
Previous version -> v2.4.1
This package use WebView, but WebView from react-native is deprecated, so you download with react-native-webview
.
$ npm install react-native-simple-twitter react-native-webview --save
if you want to use more twitter types, use abraham/twitter-d
$ npm install --save-dev twitter-d
import { useTwitter, SimpleTwitterTypes } from 'react-native-simple-twitter';
// init with twitter application key and secret
const { twitter, TWModal, loggedInUser, accessToken } = useTwitter({
// onSuccess:(user,accessToken) => void,
// onError?:(err) => void,
consumerKey?:string,
consumerSecret?:string,
})
useEffect(() => {
console.log(loggedInUser);
console.log(accessToken);
},[loggedInUser,accessToken]);
Name | Description |
---|---|
onSuccess:(user,accessToken) => void | return loggedin user object and access token |
onError?:(err) => void | if login failed, call this method |
consumerKey?:string | application key |
consumerSecret?:string | application secret key |
Name | Description |
---|---|
twitter.login() | Get login url and open TWModal |
twitter.switch() | Get new login url with reset cookie and open TWModal |
twitter.setConsumerKey(consumer_key,consumer_key_secret) | set application key and secret |
twitter.getAccessToken() | get access_token and access_token_secret, when user logged in app |
twitter.setAccessToken(access_token,access_token_secret) | set user access_token and access_token_secret, when you already have access_token and access_token_secret |
`twitter.api("GET" | "POST" |
twitter.get(endpoint,parameters) | alias of twitter.api . this method will be deprecated |
twitter.post(endpoint,parameters) | alias of twitter.api . this method will be deprecated |
Name | Default | Description |
---|
twitter.setAccessToken(access_token,access_token_secret)
, loggedInUser
will change.loggedInUser
don't have parameter status
.twitter.setAccessToken(access_token,access_token_secret)
, accessToken
will change.import { decodeHTMLEntities } from 'react-native-simple-twitter'
console.log(decodeHTMLEntities("& ' ' / ' / < > ""))
Tweet is include htmlencoded characters.
So this function decode special characters.
import { getRelativeTime } from 'react-native-simple-twitter'
console.log(getRelativeTime(new Date(new Date().getTime() - 32390)))
console.log(getRelativeTime("Thu Apr 06 15:28:43 +0000 2017"))
Tweet created_at convert to relative time. ex) 1s 15m 23h
FAQs
Twitter API client for React Native without react-native link
The npm package react-native-simple-twitter receives a total of 9 weekly downloads. As such, react-native-simple-twitter popularity was classified as not popular.
We found that react-native-simple-twitter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.