Hallo i want to make vue app with frappe UI, and i want to enable google o auth, on frappe login screen it succesfully working. On my vue app it working too BUT WHEN MY FRAPPE APP IS LOGGED IN, my question is, there is code on apps/frappe/frappe/www/login.py that fetching to Social Login Key like this code below
providers = frappe.get_all(
"Social Login Key",
filters={"enable_social_login": 1},
fields=["name", "client_id", "base_url", "provider_name", "icon"],
order_by="name",
)
for provider in providers:
client_secret = get_decrypted_password("Social Login Key", provider.name, "client_secret")
if not client_secret:
continue
icon = None
if provider.icon:
if provider.provider_name == "Custom":
icon = get_icon_html(provider.icon, small=True)
else:
icon = f"<img src={escape_html(provider.icon)!r} alt={escape_html(provider.provider_name)!r}>"
if provider.client_id and provider.base_url and get_oauth_keys(provider.name):
context.provider_logins.append(
{
"name": provider.name,
"provider_name": provider.provider_name,
"auth_url": get_oauth2_authorize_url(provider.name, redirect_to),
"icon": icon,
}
)
context["social_login"] = True
and this is my code when fetchin Social Login Key on vue
const socialData = createListResource({
doctype: "Social Login Key",
fields: ["auth_url_data", "authorize_url", "client_id", "icon", "provider_name"],
debug: 1,
transform(data) {
return data.map((social) => {
const scope = JSON.parse(social.auth_url_data).scope
return {
...social,
url: social.authorize_url + "?redirect_uri=" + window.location.origin + "/api/method/frappe.integrations.oauth2_logins.login_via_" + social.provider_name.toLowerCase() + "&state=" + btoa(JSON.stringify({ site: window.location.origin, token: social.client_id, redirect_to: "/app/user/enabled=1" })) + "&scope=" + scope + "&response_type=code&client_id=" + social.client_id,
}
})
},
})
socialData.fetch()
Why on my vue app need to login first to fetch that doctype? and how to solve it? Thanks