[Answered ]-How to do account activation through email using Djoser and React Native?

1👍

I integrated djoser and reactjs. so it’s nearly similar like react native.It is may be usefull.

IN your django settings.py:

DJOSER = {
       ....

    'ACTIVATION_URL': 'user_activation/{uid}/{token}',
    'SEND_ACTIVATION_EMAIL': True,
    'SEND_CONFIRMATION_EMAIL':True,
      .....
}

Urls.js

....
<Route path="/user_activation/:uid/:token" component={ActivateAccount} />
....

ActivateAccount.js:

const ActivateAccount = () => {

const { uid, token } = useParams();

const history = useHistory();

const activeClick = (e) => {
   
    Axios.post('http://localhost:8000/auth/users/activation/', { uid: uid, token: token })
        .then(() => {
            history.push('/login')
        })
        .catch(err => {
            alert(err.response.data);
        })
};

return (
    <Fragment>
        <Button onClick={activeClick} color="primary">Activate Now</Button>
    </Fragment>
)
}

export default ActivateAccount;

0👍

I’m having the same issue and found a blog article that shows how to make a link to your react-native mobile app: https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e

This uses something called linking in react-native:

More specifications:

With djoser you can send an email to the user that provides an url to activate the user’s account. This url you send should link to your frontend which will then call your api and activate the user. With the technique specified in the blog you will probably be able to do such a thing.

Leave a comment