小编ela*_*eee的帖子

我应该在哪里存储 code_verifier(使用 PKCE 的 oauth 2.0 代码授权流程)

我目前正在 SSR 页面中使用 PKCE 进行 oauth 2.0 代码授权授权(在前面使用 React,在后面使用 Express)。

code_verifier当客户端请求授权服务器代码时我应该存储在哪里(当授权服务器创建 code_challenge 和 code_verifier 以进行验证时)。我在独立的堆栈/基础设施中运行授权服务器。

我应该存储code_verifier在 req.headers 中吗?(参见Campbell OAuth TBPKCE-00 草案

我们正在遵循RFC6749

node.js oauth-2.0 reactjs oauth2orize pkce

7
推荐指数
1
解决办法
953
查看次数

sectionList中的自定义节样式

您知道如何在sectionList组件React-native中制作水平截面(特定)吗?我想水平放置第二部分,我尝试使用flex:1和flexDirection:'row'修改renderItem中的项目样式,但是不起作用。任何人都知道如何设置节的自定义样式或制作水平节?(红色圆圈)

        <View>
        <SectionList
          renderItem={({item, index, section}) => <CellMainNews isFirst={index===0 ? true: false} data={ item } onPress = {item.onPress } />}
          renderSectionHeader={({section: {title}}) => (
            <Text style={{fontWeight: 'bold'}}>{title}</Text>
          )}
          sections={[
            {title: 'Top post', data: this.props.featured.top, renderItem: overrideRenderItem },
            // this section
            {title: 'Featured posts', data: this.props.featured.secundary, renderItem: overrideRenderItemTwo },
            {title: 'Stories', data: this.props.stories},
          ]}
          keyExtractor={(item, index) => item + index}
            />

            {this.props.loading &&
                <View>
                    <ActivityIndicator size={100} color="red" animating={this.props.loading} />
                </View>
            }
        </View>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

问候。

react-native react-native-sectionlist

5
推荐指数
1
解决办法
2479
查看次数

有没有更好的方法用reduce测试n个函数?[JS]

我做了一个简单的函数来测试(调用)“n”个参数(函数)并将结果作为数组返回,但我不确定这是否是使用 reduce 的正确方法(检查下面的注释行)。

const sucess = () => true;
const failed = () => false;


const tester = (...args) => {
 return [...args].reduce((acc,currentValue) => { 
    if(typeof acc === 'function') // this is right?
        return [acc(),currentValue()]
    return [...acc,currentValue()]
  });
}

console.log(tester(sucess,failed,failed,sucess));
Run Code Online (Sandbox Code Playgroud)

你是什​​么

javascript testing reduce function ecmascript-6

0
推荐指数
1
解决办法
70
查看次数