Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!

Adobe Analyitics API oAuth does not work.

Avatar

Level 1

Hello,

I have a oAuth problem.
The error code is below.

{"message": {"error": "invalid_request", "error_description": "The access token has not been permissioned to access Adobe Analytics"}}

I'm trying to use Adobe Anlytics API on Lambda with phyton.

Program code is below.

import os

import json

import datetime

import requests

import boto3

from boto3.dynamodb.conditions import Key, Attr

dynamodb = boto3.resource('dynamodb')

aa_user = os.environ['aa_user']

aa_secret = os.environ['aa_secret']

aa_rsid = os.environ['aa_rsid']

aa_endpoint = os.environ['aa_endpoint']

aa_reportqueue = os.environ['aa_reportqueue']

aa_tokenurl = os.environ['aa_tokenurl']

#aa_endpoint = https://api4.omniture.com/admin/1.4/rest/

#aa_reportque = ?method=Report.Queue

def lambda_handler(event, context):

    data = {'reportDescription' : {'reportSuiteID':aa_rsid}}

    return {'message':adobe_api(aa_reportqueue,data)}

def adobe_token():

    data = {'grant_type':'client_credentials'}

    token = requests.post(aa_tokenurl,data=data,auth=(aa_user,aa_secret)).json()

    return token['access_token']

def adobe_api(method,data):

    token = adobe_token()

     return requests.post(aa_endpoint+'?method='+method+'&access_token='+token,data=data).json()

Thank you for reading this far. Any information would be greatly appreciated.

1 Reply

Avatar

Employee Advisor

Have you confirmed that your Analytics account belongs to a permission group that can access the API? Typically the group name is 'Web Services access'.