Expand my Community achievements bar.

Join us for our next community Coffee Break on February 28th! Four of our Analytics Champions will be joining us to discuss Summit tips, best practices, and any of your Analytics questions!

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'.