# Fetch User Profile Script not triggering?

**URL:** <https://community.auth0.com/t/fetch-user-profile-script-not-triggering/58556>\
**Category:** Get Help\
**Created:** [February 25, 2021, 11:45pm UTC](https://community.auth0.com/t/fetch-user-profile-script-not-triggering/58556 "2021-02-25T23:45:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shocker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shocker/32/14359_2.png) [@shocker](https://community.auth0.com/u/shocker)\
**Post date:** [February 25, 2021, 11:45pm UTC](https://community.auth0.com/t/fetch-user-profile-script-not-triggering/58556/1 "2021-02-25T23:45:56Z")

</div>

I have created a custom OAuth2 Social Connection and it is working fine but Fetch User Profile Script is not triggering.  
I am redirected to redirect\_url but my script does not run.

```auto
function(accessToken, ctx, cb) {
    const profile = {};
    // Call OAuth2 API with the accessToken and create the profile
    console.log(accessToken);
    cb(null, profile);
  }

```

EDIT: The token doesn’t get printed in the browser console.  
For reference, I’m trying to achieve this: [https://github.com/projectestac/moodle-local\_oauth#how-to-use](https://github.com/projectestac/moodle-local_oauth#how-to-use)

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [February 26, 2021, 5:31pm UTC](https://community.auth0.com/t/fetch-user-profile-script-not-triggering/58556/2 "2021-02-26T17:31:53Z")

</div>

Hi @shocker , welcome to the community!  
The `console.log` won’t be on the browser as this script is executed on the server, this is used by Auth0 to create the user’s profile based on the response from the OAuth IdP:  
[https://auth0.com/docs/connections/social/oauth2#fetch-user-profile-script](https://auth0.com/docs/connections/social/oauth2#fetch-user-profile-script)

You should be able to see what the `console.log` prints out however by using the Realtime webtasks extension to help with debugging the script:

> **[Real-time Webtask Logs Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs)**
>
> Learn how to configure and use the Auth0 Real-time Webtask Logs extension.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 13, 2021, 5:31pm UTC](https://community.auth0.com/t/fetch-user-profile-script-not-triggering/58556/3 "2021-03-13T17:31:56Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
