响应本机Instagram授权和WebView

我正在尝试使用react-native-switch按钮打开Instagram授权页面。该按钮很好用,但WebView不能。

我正在将WebView与我的app_id令牌和重定向网址一起用作网站。我对此认证有一些疑问:

  1. 单击按钮后我将返回WebView,但没有显示弹出/重定向/身份验证页面。使用WebView标签应该看到什么?我需要创建一个模式并将WebView嵌入到该模式中吗?
  2. 如果我留在RN应用中,RN应用如何理解重定向URL?我将重定向网址设置为什么?

我什至缺少auth令牌生成之前的一些步骤,我们将不胜感激。

代码:

const redirectUser = () => {
    return <WebView source={{uri: 'https://api.instagram.com/oauth/authorize?app_id=123456789&redirect_uri=http://testwebsite.co/&scope=user_profile,user_media&response_type=code'}} style={{marginTop: 20}} />
};
 ...
     <View style ={styles.socialContainerStyle}>
         <Text style ={styles.titleStyle}>Instagram </Text>
            <Switch
                style={styles.switchStyle}
                value={instagramRadio}
                onValueChange={setInstagramRadio}
                onChange={redirectUser}
                disabled={false}
                circleSize={20}
                barHeight={4}
                circleBorderWidth={1}
                backgroundactive={'green'}
                backgroundInactive={'gray'}
                circleactiveColor={'#30a566'}
                circleInactiveColor={'#000000'}
                changeValueImmediately={true}
                switchLeftPx={2} 
                switchRightPx={2} 
                switchWidthMultiplier={2} 
            /> 
    </View> 

注意事项: 出于安全原因,我省略了实际的重定向URL和令牌

我不会直接在app_id中进行硬编码或重定向uri,这只是为了便于阅读

我不想将用户的登录名与instagram绑定,我只想授权连接并可能以后在feed中显示照片

weika123456789 回答:响应本机Instagram授权和WebView

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3149647.html

大家都在问