django-oauth-toolkit icon indicating copy to clipboard operation
django-oauth-toolkit copied to clipboard

access django request in OAuth2Validator.get_additional_claims

Open amirhoseinbidar opened this issue 3 years ago • 0 comments

In get_additional_claims I want to give url of users avatar, some thing like google claims... But django image field just give path of file without domain base on https://stackoverflow.com/questions/1451138/how-can-i-get-the-domain-name-of-my-site-within-a-django-template I have to somehow access django request to find site domain and build avatars full url

But base on https://django-oauth-toolkit.readthedocs.io/en/1.5.0/oidc.html?highlight=OAuth2Validator#adding-claims-to-the-id-token request object that pass to get_additional_claims isn't a django request object and seems have no data of site domin and its schema to build full url

I know i can set a variable in setting like SITE_URL or use contrib.site to build full url and currently use SITE_URL but using django request objest is far better solution because won't break when domain changed

So is there any way to access django request object or can you provide a interface( or anything ) for it?

amirhoseinbidar avatar Oct 01 '21 14:10 amirhoseinbidar