authorizer icon indicating copy to clipboard operation
authorizer copied to clipboard

Signup not verifying email with Redis config

Open peter-wd-1 opened this issue 3 years ago • 12 comments

Version: 0.26.0

Describe the bug

Signup not verifying user email with redis.

Steps To Reproduce

use docker image for redis:

 redis:
    image: 'bitnami/redis:latest'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_PORT_NUMBER=7000
    ports:
      - 7000:7000
    networks:
      - api-service

setup env for authorizer server:

    environment:
      - REDIS_URL=redis://redis:7000

signup:

await authorizer.signup({
      email,
      password: genPW,
      confirm_password: genPW,
      redirect_uri: config.authorizer.redirectURL,
      roles: [`${role}`],
    })

this result out:

access_token: null,
    expires_in: null,
    refresh_token: null,
    id_token: null,

It all works with the same code if I don't use redis. Thanks :)

peter-wd-1 avatar Jul 13 '22 16:07 peter-wd-1

@peter-wd-1 by any chance you enabled email verification? You also can check message attribute in response.

lakhansamani avatar Jul 13 '22 16:07 lakhansamani

@peter-wd-1 I was trying to reproduce this, I don't think its redis issue, it might be because u have configured smtp server & that would have enabled email verification.

You can disable that from dashboard Screenshot 2022-07-13 at 10 38 01 PM

lakhansamani avatar Jul 13 '22 17:07 lakhansamani

Hi, @lakhansamani

I've already disabled email verification and I have setup SMTP as well.

Screen Shot 2022-07-14 at 8 10 42 AM

So smtp setting and disable email verification can't be enabled at the same time?

peter-wd-1 avatar Jul 14 '22 12:07 peter-wd-1

Added little more context on this, I've been sending verification email to user separately from my own server. Authorizer server doesn't know if my server successfully verified user email. So I need to sign up user verified as default after I verify them my self. The reason I do this is that I need to signup user with pre generated password. And control user authentication flow in this way. Then later, user would use forgot password thus need SMTP as well.

peter-wd-1 avatar Jul 14 '22 12:07 peter-wd-1

@peter-wd-1 thank you for that information. Here the flow of execution will matter

Example if you disabled email verification first and then added smtp config it could change things. But I will dig deep here and let you know the root cause

lakhansamani avatar Jul 14 '22 12:07 lakhansamani

Thanks for quick reply! I might need to try setting disable email verification again as a workaround.

peter-wd-1 avatar Jul 14 '22 12:07 peter-wd-1

@peter-wd-1 I was checking the code today and found email verification is done based on config flag only: https://github.com/authorizerdev/authorizer/blob/main/server/resolvers/signup.go#L179

However, when you update smtp config from dashboard / env file, I have logic to update that flag https://github.com/authorizerdev/authorizer/blob/main/server/resolvers/update_env.go#L236

So I think it is the flow issue. Toggling that switch of email verification should solve the issue.

lakhansamani avatar Jul 15 '22 03:07 lakhansamani

Let me know if that helps, else I can dig dipper :-)

lakhansamani avatar Jul 15 '22 03:07 lakhansamani

@lakhansamani thanks :) I'll try that today and let you know.

peter-wd-1 avatar Jul 16 '22 11:07 peter-wd-1

@peter-wd-1 any update on this?

lakhansamani avatar Jul 20 '22 17:07 lakhansamani

Hey @lakhansamani Sorry, was busy for something else :(

I tested the flag truned off and on again. But no luck.. I also tried to start the container without SMTP config and setup from dashboard first then truned on the flag. Still having the same issue :(

peter-wd-1 avatar Jul 22 '22 21:07 peter-wd-1

@peter-wd-1 can you once try upgrading to latest version and see if the issue is still there.

I will also continue my try to reproduce it

Thanks

lakhansamani avatar Jul 23 '22 05:07 lakhansamani

Sorry for late update after long time. So the issue seems resolved after update somehow. I don't know what caused the issue. But it works fine now Thanks.

peter-wd-1 avatar Aug 20 '22 20:08 peter-wd-1

Glad that it is resolved now :-)

lakhansamani avatar Aug 21 '22 09:08 lakhansamani