QQ 反应- 内置链接
简单 链接 登录库 反应- Native 与 网络视频 改为 a 模式
福利
- 光线: 不需要像其他选项一样连接本地图书馆
- 简单:获取符和过期,您用访问 token处理自己的登录
- 当然: 开源
- 几乎可以读取的代码( C): Java脚本和反应
安装
$ yarn add @gcou/react-native-linkedin
同伴依赖关系
| 软件包 | 最小版本 |
|---|---|
| 反应 | (单位:千美元) |
| 反应-内在 | 页:1 |
| 反应-内生-元件-随机值 | 时间: |
| 反应-本地-网络视图 | * 联合国 |
警卫
请注意, 您应该给您的链接客户端 ID , 而不是您的密钥 . 你应该知道,如果直接存储到您的代码中,可以找到密钥. 我强烈建议不要在你的密码上公布客户秘密密钥 但找到办法保密
<LinkedInModal
shouldGetAccessToken={false}
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={({ authentication_code }) => console.log(`Post this ${authentication_code} to your server.`)}
/>
示例
// See ./example/App.tsx file for details
import React, { ReactElement, useRef } from 'react';
import { StyleSheet, View, Button } from 'react-native';
import LinkedInModal, { LinkedInModalRef } from '@gcou/react-native-linkedin';
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
justifyContent: 'center',
alignItems: 'center',
},
})
export default function AppContainer() : ReactElement {
const linkedRef = useRef<LinkedInModalRef>(null);
return (
<View style={styles.container}>
<LinkedInModal
ref={linkedRef}
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
clientSecret="[ Your client secret from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={token => console.log(token)}
/>
<Button title="Log Out" onPress={() => linkedRef.current?.logoutAsync()} />
</View>
)
}
道具
| 名称 | 类型 | 需求 | 默认 | 说明 |
|---|---|---|---|---|
| 客户端ID | 字符串 | 所需经费 | 你的客户身份 | |
| 字符串 | 使用情况 应获取访问token%false] 读取 授权 代码 成功返回时 | 不应存储在应用程序中 警报! 你的客户秘密 | ||
| 重定向乌里 | 字符串 | 所需经费 | 您的定向Uri | |
| 成功时 | 函数 | 所需经费 | 函数将召回成功 | |
| 认证状态 | 字符串 | 选项 | require('uuid').v4() | Author的状态,更安全 |
| 错误 | 函数 | 选项 | console.error(err) | 函数会被调回错误 |
| 关闭 | 函数 | 选项 | 函数将调用近模式 | |
| 打开 | 函数 | 选项 | 函数将调用打开的模式 | |
| 签名时 | 函数 | 选项 | 当用户签名时, 函数会被调回 | |
| 权限 | 字符串 [] | 选项 | 'r_liteprofile', 'r_emailaddress' | 访问令牌权限 |
| 渲染按钮 | 反应元素 | 选项 | 自定义 Linked In 按钮的渲染 | |
| 制作关闭 | 反应元素 | 选项 | 自定义关闭按钮 | |
| 链接文本 | 字符串 | 选项 | 'Login with LinkedIn' | 链接标签 |
| 容器样式 | 样式配置 | 选项 | 自定义容器样式 | |
| 包装板 | 样式配置 | 选项 | 自定义包装样式 | |
| 关闭样式 | 样式配置 | 选项 | 自定义关闭样式 | |
| 动画类型 | Modal.props.types.animation Type 互联网档案馆的存檔,存档日期2013-12-22 | 选项 | fade | 自定义动画 Type 样式 : “ 无 ” 、 “ 滑行 ” 或 “ 淡出 ” |
| 应当获取访问 | 嘘 | 选项 | true | 设定为错误以接收“ 授权代码” 而不是“ 访问符” |
| 区域图文集 | 对象 | 选项 | {top: 20, bottom: 20, left: 50, right: 50} | 设定增加文本触摸区域的值 |
| 已失效 | 嘘 | 选项 | false | 禁用链接登录按钮 |
捐款
欢迎公关!
财务问题
它是否在机器人和iOS上都得到支持和测试?
对
如何登录反应- 本地链接 ?
<View style={styles.container}>
<LinkedInModal
ref={linkedRef}
clientID="[ Your client id from https://www.linkedin.com/developer/apps ]"
clientSecret="[ Your client secret from https://www.linkedin.com/developer/apps ]"
redirectUri="[ Your redirect uri set into https://www.linkedin.com/developer/apps ]"
onSuccess={token => console.log(token)}
/>
<Button title="Log Out" onPress={() => linkedRef.current?.logoutAsync()} />
</View>
替代品
许可证
由 q 制作