User profile script for custom social connection

Hi,
I can’t seem to figure out how I can fetch user profile data using the following request & response
REQUEST:

GET https://www.bungie.net/Platform/User/GetCurrentBungieNetUser/
X-API-Key: {api-key}
Authorization: Bearer {access-token}

RESPONSE

{
    "Response": {
        "membershipId": "15430065",
        "uniqueName": "15430065",
        "displayName": "Vaslaw",
        "profilePicture": 70309,
        "profileTheme": 1126,
        "userTitle": 0,
        "successMessageFlags": "0",
        "isDeleted": false,
        "about": "",
        "firstAccess": "2017-08-29T16:24:44.87Z",
        "lastUpdate": "2017-10-24T16:41:29.936Z",
        "context": {
            "isFollowing": false,
            "ignoreStatus": {
                "isIgnored": false,
                "ignoreFlags": 0
            }
        },
        "showActivity": true,
        "locale": "en",
        "localeInheritDefault": false,
        "showGroupMessaging": true,
        "profilePicturePath": "/img/profile/avatars/stoshsoldavatar.gif",
        "profileThemeName": "d2_26",
        "userTitleDisplay": "Newbie",
        "statusText": "",
        "statusDate": "0001-01-01T00:00:00Z",
        "blizzardDisplayName": "Vaslaw#2506"
    },
    "ErrorCode": 1,
    "ThrottleSeconds": 0,
    "ErrorStatus": "Success",
    "Message": "Ok",
    "MessageData": {}
}

What script can fetch membershipId, displayname and profilePicturePath?
@phantomcat877

If you haven’t done so already you should follow the instructions to add a generic OAuth 2.0 authorization server as a custom social connection. In particular, the section about the fetchProfileScript which would be where you would perform the call you describe. The access token required is passed into that custom script as a parameter and I’m assuming the API key is a static value so you would just add it within your custom script itself.

1 Like