Hello All,
Using this link OAuth 2 , to get the userinfo post OAuth integration with frappe.
There are two questions:
The above end point when actually called in the integration returns
{"sub":"xxxxx","name":"Name","given_name":"Name","family_name":null,"email":"email@gmail.com","picture":null}
The other parameters are not returned (as documented in the above link).
2) Can we configure to return any additional information with the userinfo from frappe ?
Thank you
gaurav08suri:
The above end point when actually called in the integration returns
picture = None
frappe_server_url = get_server_url()
valid_url_schemes = ("http", "https", "ftp", "ftps")
if user.user_image:
if frappe.utils.validate_url(user.user_image, valid_schemes=valid_url_schemes):
picture = user.user_image
else:
picture = frappe_server_url + "/" + user.user_image
userinfo = frappe._dict(
{
"sub": frappe.db.get_value(
"User Social Login",
{"parent": user.name, "provider": "frappe"},
"userid",
),
"name": " ".join(filter(None, [user.first_name, user.last_name])),
"given_name": user.first_name,
"family_name": user.last_name,
"email": user.email,
Latest stable v13 should not cause this problem.
curl https://erp.example.com/api/method/frappe.integrations.oauth2.openid_profile -H 'Authorization: Bearer AcCeSstOkEn' | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 790 100 790 0 0 3157 0 --:--:-- --:--:-- --:--:-- 3147
{
"sub": "********",
"name": "Revant Nandgaonkar",
"given_name": "Revant Nandgaonkar",
"family_name": null,
"email": "*********",
"picture": "*********",
"roles": [
"Accounts Manager",
"Knowledge Base Contributor",
"Purchase User",
"Website Manager",
"Accounts User",
"Sales Master Manager",
"Blogger",
"Inbox User",
"System Manager",
"Report Manager",
"Newsletter Manager",
"Dashboard Manager",
"Maintenance User",
"Sales User",
"Script Manager",
"Prepared Report User",
"Purchase Manager",
"Translator",
"Maintenance Manager",
"Purchase Master Manager",
"Knowledge Base Editor",
"Sales Manager",
"All",
"Guest"
],
"iss": "http://erp.example.com"
}
gaurav08suri:
Can we configure to return any additional information with the userinfo from frappe ?
If you’ve a custom app then override the whitelisted function from hooks.py