@ aws-amplify / auth federatedSignUp函数?

时间:2020-07-28 21:44:26

标签: reactjs amazon-cognito aws-amplify

使用使用react({{1})的npm软件包@aws-amplify/auth时,有一些导出的功能,例如import Auth from '@aws-amplify/auth'Auth.signUp({...})Auth.federatedSignIn()将用户发送到路径为federatedSignIn的联合登录端点。我想将它们发送到/login路径,但是没有这样的/signup函数,有人知道将它们发送到federatedSignUp()联合端点的解决方案吗? < / p>

2 个答案:

答案 0 :(得分:2)

我的解决方案是将用户重定向到以下URL:

size_t getIndex(int row, int col, int width)
{
    return row*width+col;
}


__kernel void matrixMul(__global const float* restrict a, 
    __global const float* restrict b,  //assume tranposed
    __local float* restrict a_local,
    __local float* restrict b_local,
    __global float* restrict result) 
{
    const int row=get_global_id(0);
    const int col=get_global_id(1);

    const int limit=get_global_size(0);


    const int blockSize=get_local_size(0);
    const int gidRow=get_local_id(0);
    const int gidCol=get_local_id(1);

    
    float sum=0;
    for(int blockIndex=0; blockIndex < (limit/blockSize); ++blockIndex)
    {
        /*copy block -> local memory*/
        a_local[getIndex(gidRow, gidCol, blockSize)]=a[getIndex(row, col, limit)];
        b_local[getIndex(gidRow, gidCol, blockSize)]=b[getIndex(row, col, limit)];
        barrier(CLK_LOCAL_MEM_FENCE);

        /*block multiply*/
        __local float* restrict a_local_row=&a_local[getIndex(gidRow, 0, blockSize)];
        __local float* restrict b_local_row=&b_local[getIndex(gidCol, 0, blockSize)];
        for(int i=0; i<blockSize; ++i)
        {
            sum+= (*a_local_row) * (*b_local_row);
            ++a_local_row;
            ++b_local_row;
        }
    }

    result[getIndex(row, col, limit)]=sum;
}

答案 1 :(得分:0)

使用@jellycsc的解决方案并对其进行扩展(因为我遭到了未经授权)是可行的(我建议其他任何人都去他们的注册URL并手动并系统地替换它的值)。

const baseUrl = `https://${aws.idpDomain}/signup`
const search = `?response_type=token&client_id=${aws.userPoolWebClientId}&redirect_uri=${encodeURIComponent(
    aws.redirectSignIn
  )}&identity_provider=COGNITO&scope=email%20openid%20profile`

window.location.replace(baseUrl + search)