# Access\_denied error when “trying” Kakao social connection

**URL:** <https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498>\
**Category:** Get Help\
**Tags:** social-connection, social-connections, login\
**Created:** [September 12, 2021, 2:40pm UTC](https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498 "2021-09-12T14:40:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![imnoone](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/imnoone/32/31680_2.png) [@imnoone](https://community.auth0.com/u/imnoone)\
**Post date:** [September 12, 2021, 2:40pm UTC](https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498/1 "2021-09-12T14:40:17Z")

</div>

I just set up my Kakao social connection. When I hit the `Try Connection` button, I get the following error message:

```auto
  "error": "access_denied",
  "error_description": "Invalid scope: profile"

```

Since the underlying code that implements Kakao social login is not provided, debugging was limited, and I couldn’t find the cause of the problem.

(One possibility: It may or may not be the problem of inequivalence of parameter Id.  
What permissions Auth0 is requesting: profile.  
What permissions Kakao provides as an accessible parameter(attribute) Id: profile\_nickname, profile\_image )

What is the problem? Thanks!

* * *

Also, could you (Auth0 developement team) please add more attributes on the permissions list?  
There are about ten more attributes that Kakao is providing but are not in the Auth0 Kakao social connection permissions list.

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [April 20, 2022, 4:37pm UTC](https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498/2 "2022-04-20T16:37:01Z")

</div>

Hi @imnoone ,

I know this is a very late response but I found this thread while looking for answers to the same issue you’ve experienced!

I did some more digging into the issue, and it seems like Kakao has made some changes to their OAuth OIDC flow and separated the `profile` consent to two separate consents, `profile_nickname` and `profile_image `. While old Kakao application registrations can use the `profile` scope, new application registrations must use the `profile_nickname` and `profile_image` scopes. You can read more about this change here - [닉네임/프로필 사진 동의 항목 분리 및 API 응답 변경사항 안내 / [Change Notice] Separation of consent items (nickname/profile image) and API response - Notice / 공지 - 카카오 데브톡](https://devtalk.kakao.com/t/api-change-notice-separation-of-consent-items-nickname-profile-image-and-api-response/116209).

Due to this change, the Kakao social connection provided by Auth0 is incompatible with the new flow. I will report this to the Engineering team, but it will take some time for them to review this change and update the Kakao social connection to support the new flow.

Having said that, you can still create a Custom Social Connection in Auth0 to support the new flow. I will share how to configure a Custom Social Connection here.

1. Create a Custom Social Connection by navigating to **Authentication → Social → Create Connection → Create Custom**
2. Set the name as Kakao (or a name you prefer)
3. Add **Authorization URL** as - `https://kauth.kakao.com/oauth/authorize`
4. Add **Token URL** as - `https://kauth.kakao.com/oauth/token`
5. Add the **Scope** as - `profile_nickname profile_image account_email`
6. Add the **Client ID** obtained Kakao Developer Portal (App Keys → Rest API Key)
7. Add the Client Secret obtained from Kakao Developer Portal (Kakao Login → Security)
8. Use the below code for **Fetch User Profile Script**

```auto
function fetchUserProfile(accessToken, context, callback) {
  request.get(
    {
      url: "https://kapi.kakao.com/v2/user/me",
      headers: {
        Authorization: "Bearer " + accessToken,
      },
    },
    (err, resp, body) => {
      if (err) {
        return callback(err);
      }

      if (resp.statusCode !== 200) {
        return callback(new Error(body));
      }

      let bodyParsed;

      try {
        bodyParsed = JSON.parse(body);
      } catch (jsonError) {
        return callback(new Error(body));
      }

      const profile = {
        user_id: bodyParsed.id,
        name: bodyParsed.kakao_account.profile.nickname,
        picture: bodyParsed.kakao_account.profile.thumbnail_image_url,
        email: bodyParsed.kakao_account.email,
        email_verified: bodyParsed.kakao_account.is_email_verified,
      };

      callback(null, profile);
    }
  );
}

```

That’s it! Now you should be able to test the connection by using the “Try Connection” button.

You can also set an icon to the connection using the **Update a connection** endpoint of the Management API ([Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id)). Follow the steps given below to set the connection icon.

1. Obtain a Management API Access Token by Navigating to the **Applications → APIs → Auth0 Management API → API Explorer**
2. Copy the Connection ID of the Custom Social Connection you just created. You can obtain the connection id by navigating to **Authentication → Social → SELECT YOUR CONNECTION** and on the settings page, you should see the **Identifier** value.
3. Using a tool like Postman or API Explorer, call the **Get a connection** endpoint of the Management API to retrieve all the connection setting parameters. ([Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id))
4. You should get an JSON object similar to the example given below.

```auto
{
  "id": "CONNECTION ID",
  "options": {
    "scope": "profile_nickname profile_image account_email",
    "scripts": {
      "fetchUserProfile": "<FETCH USER PROFILE CODE>"
    },
    "tokenURL": "https://kauth.kakao.com/oauth/token",
    "client_id": "CLIENT ID",
    "client_secret": "CLIENT SECRET",
    "customHeaders": "",
    "authorizationURL": "https://kauth.kakao.com/oauth/authorize"
  },
  "strategy": "oauth2",
  "name": "Kakao-2",
  "is_domain_connection": false,
  "enabled_clients": [
    "CLIENT ID"
  ],
  "realms": [
    "Kakao-2"
  ]
}

```

1. Copy the `options` object from the response you’ve received on step 4 and add the `icon_url` value to it. Example is given below.

```auto
{
   "options":{
      "scope":"profile_nickname profile_image account_email",
      "scripts":{
         "fetchUserProfile":"<FETCH USER PROFILE CODE>"
      },
      "tokenURL":"https://kauth.kakao.com/oauth/token",
      "client_id":"CLIENT ID",
      "client_secret":"CLIENT SECRET",
      "customHeaders":"",
      "authorizationURL":"https://kauth.kakao.com/oauth/authorize",
      "icon_url": "https://cdn.auth0.com/marketplace/catalog/content/assets/creators/kakao/kakao-avatar.png"
   }
}

```

1. Send the `options` object to the **Update a connection** endpoint ([Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id))

Now, the connection’s icon will be properly displayed in the Universal Login Page.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 22, 2022, 7:13am UTC](https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498/3 "2022-04-22T07:13:34Z")

</div>

Thanks for helping on this one @supun!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 28, 2022, 11:30am UTC](https://community.auth0.com/t/access-denied-error-when-trying-kakao-social-connection/69498/4 "2022-04-28T11:30:19Z")

</div>


