Hi, I am trying to use this guide for allowing use...
# ask-a-descoper
g
Hi, I am trying to use this guide for allowing users to login with social login if have already created a user via magic link with a matching email address. However, after clicking "Expose Raw OAuth Response", I am not able to actually retrieve the OAuth response? It also is not present on the dropdown as value when setting attributes in scriptlet. I attempted to build parts of the flow and inspect the result of the scriplet in a screen. By using the exact scriptlet from your premade template. But I keep getting error "Error fetching URL https://static.descope.com/pages/P2kgc9ffB5j4i1CYjABex6vnVfDp/v2-beta/oauth-authentication-sign-in/new-105.html?_=true [Error fetching URL https://static.descope.com/pages/P2kgc9ffB5j4i1CYjABex6vnVfDp/v2-beta/oauth-authentication-sign-in/new-105.html?_=true [404]] undefined" AND "Failed to fetch flow page Cannot destructure property 'body' of '(intermediate value)' as it is undefined."
c
@Avi Glozman @Bhagyesh Parna can you follow up here?
a
Hi Gustav, can you clarify which guide you're following?
You should be able to enable social login merging, as described here
g
Hi @Avi Glozman @Chris Carper This is exactly the guide I am following : https://docs.descope.com/auth-methods/oauth/customize/handle-oauth-provider-unverified-emails I am also using settings from this template exactly: https://app.descope.com/flows?template=sign-in-allow-social-when-signups-not-allowed&_gl=1*dfllva*_gcl_au*MTI1NjkwNzgxNi4xNzY4MjA4MTQ3LjM4ODAwMTgzNC4xNzcwODA0OTA4LjE3NzA4MDQ5MTE. Yet I still get the issue. My auth settings is promote "Promote the email to be a login ID" and I do not have ANY issue when I use "Sign-up or In" action. The issue occurs when I use sign in action on a account that does not already have the sub as a loginID. It happens regardless of whether it is verified or unverified.
Hi @Avi Glozman @Chris Carper, by any chance have you found out why this issue occurs and raw oauth response cannot be retrieved using scriplet? Right now anyone who attempts login with social login, is going to get an error...
m
@Akash Jivane can you follow up here ?
a
@Meir Wahnon Yes, sure!
@Gustav Jandrup Can you please share the flow json ?
g
Thank you so much for the help 🙏 I just to emphasize that although I try to reference oauthresponse in my scriptlet, it does not work on my end.
a
Hi @Gustav Jandrup I can see exactly why
oauthResponse
isn’t working in your scriptlet. Right now you’re passing:
Copy code
oauthResponse → oauthResponse
But in Descope flows, the OAuth response isn’t a global variable it should be stored under the specific OAuth exchange step in the flow context. Can you please once and access the
oauthResponse
correctly in your scriptlet and let me know this works ?
g
Thank you for the response! 😄 I am having trouble understanding what you want me to do @Akash Jivane? I am using the exact same settingsin the template as your documentation suggests I use: https://app.descope.com/flows?template=sign-in-allow-social-when-signups-not-allowed[…]gxNi4xNzY4MjA4MTQ3LjM4ODAwMTgzNC4xNzcwODA0OTA4LjE3NzA4MDQ5MTE This template actually does work, but in the flow I sent you it does not work. Could you make it more clear to me what accessing oauthResponse correctly loks like? I am unable to find the oauthResponse variable from dropdown...
a
Let me check the flow again that you have sent and will get back to you.
👀 1
r
@Chris Carper @Avi Glozman can you check again
c
I added console.log(oauthResponse) to your scriptlet and it does work for me - see it is logged there I did see that error for the html issue though, but after opening the screen after the scriptlet, and resaving the flow, it worked just fine. But in general, you want to display the user's email on that screen saying it doesn't exist? Something like the attached (one image shows the oauthResponse being logged to the console in the runner, the other shows the use of
{{scripts.oauthResponse.email}}
in the screen. Also attached the flow.
g
Hi, thank you for the help. @Chris Carper - the screen was just for testing purposes so I could inspect the output. I will have a look at tyour changes as soon as possible.
👍 1