TheFastOrg / Backend

Apache License 2.0
0 stars 0 forks source link

overide call back url in social auth and add restfull API for authentication #15

Open raghadsalameh1 opened 1 year ago

raghadsalameh1 commented 1 year ago

Using django-allauth library we can custom redirects. We aim to implement call back that return something like this:

    qs = {
                    "access_token": access_token,
                    "refresh_token": refresh_token,
                    "expires": expires,
                    "email": user.email,
                }

    callback_scheme = "bahbashapp://"
    url_params = "&".join(f"{key}={value}" for key, value in qs.items() if value)

    final_url = f"{callback_scheme}://#{url_params}"

    return HttpResponseRedirect(final_url)

where bahbashapp:// will call the mobile apllication with providing the paramaeters.

For authentication endpoints, we can use dj-rest-auth which is implemented on top of django-allauth.

raghadsalameh1 commented 1 year ago

I tried to implement custom redirects on the branch feature/authentication_endpoints, but still need to be working on.