Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Analyitics API oAuth does not work.

多田翔14221376
Level 1
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
Gigazelle
Employee
Employee

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