Troubleshooting AWeber API "Method requires access to Subscriber information" error - php

I'm trying to retrieve a specific subscriber from an AWeber list using the PHP SDK.
Code:
$subscribers = $account->loadFromUrl("/accounts/$account->id/lists/$list_id/subscribers");
var_dump($subscribers->find(array('email' => $email))); exit;
The problem is, I'm getting the following error:
WebServiceError: Method requires access to Subscriber information.
Google comes empty handed.

The error you're encountering is documented on the labs.aweber.com site.
You're getting that error because the findSubscriber method requires access to subscribers personal information (name, email, etc...) and your app has not requested access to subscribers personal information from the AWeber customer who authorized it.
AWeber API applications do not request access to subscribers personal data by default. You have to specifically check off that you want access to subscriber personal data before your application is authorized.
To correct this:
log into the labs.aweber.com site and request access to subscriber personal data
get a new access token for your app
use that new access token and you should be able to find by subscribers.
Please refer to the documentation links below
https://labs.aweber.com/docs/reference/1.0#subscribers (findSubscriber method)
https://labs.aweber.com/docs/permissions (permissions)
As always if you have any questions please log into the labs site, click support and someone from the API support team will be happy to assist you.

Related

Google OAuth2 authenticate and API on PHP

I have created a button that allows users to sign in with Google.
After the users choose their google accounts, I can get the following parameters as response from Google.
access tokens
id_token
expires_in
token_type
created
How can I use these parameters to use services provide from Google?
For example, can I create buttons for user to go to the gmail boxes?
If it is not the way, what are the uses of those token?
Using Google's tokens id you can get User's Information like Name Email.
You cant provide direct option to open Gmail. It will prompt user to login
You can refer this doc for more info Gmail scopes
For accessing Google services, you need the access_token. When you are creating the authentication URL, you must specify all scopes - permissions (from this list) you want to use in your application. Then Google will ask the user for consent with delegating those permissions to your application. The access token you get will allow you to perform those actions.
You can go through those Google API scopes and get an idea what you can do and what not. For example you cannot use the GMail GUI, but you can read, send, delete, and manage user's emails, send new emails and so.

Pull a user's Google+ or Gmail list of contacts and their email addresses

I'm building an app in which I'm trying to allow a user to log in through Google+ (currently using the Google API PHP Client Library) and pull their entire contact list in to decide if they want to send an email to their list from my app. I can easily see how to allow the user to grant access to multiple permissions through different Google APIs through setting scopes.
I'm struggling to see either what scope I should be setting when making a request and/or what API should accomplish pulling a logged in user's contact list along with each contact's email address.
Any help would be greatly appreciated.
I found the answer, you have to pull contacts with an valid OAuth request through the Google Contacts API. On the documentation page for the Google Contacts API, Google says:
The Google Contacts API allows client applications to view and update a user's contacts. Contacts are stored in the user's Google Account; most Google services have access to the contact list.
You can find the documentation here.
https://developers.google.com/google-apps/contacts/v3/

How do I authenticate with Google Calendar API? (PHP)

I have the Google Client PHP library set up via Packagist and Composer.
I have successfully followed this getting started guide to verify that I can use the Google Client. I followed the example and was able to retrieve a list of books through the Books API, but that's not what I'm actually trying to do.
I am creating a website for a company, and they want to have a form on their website that will allow users to request a meeting at a certain time, and then this will be automatically added to said company's Google Calendar.
In the Google Calendar API, I see a lot of information about using OAuth to have a user sign in and grant access to THEIR calendar, which can then be used, however this is not what I want at all. The user shouldn't have to sign in; the server should gain access to the company's Calendar and then make requests to that SPECIFIC calendar.
I have made a Public Access API Key in the Google API Console and entered it in my code, i.e.
$client = new Google_Client();
$client->setApplicationName($applicationName);
$client->setDeveloperKey($developerKey);
$calendarService = new Google_CalendarService($client);
$calendars = $calendarService->calendars;
$results = $calendars->get($calendarId);
dd($results);
I learned of these methods by looking through the source. I have found that, at least on my Google Calendar, the $calendarId is simply my gmail address (found under Calendar Settings). However, this code returns an error:
Error calling GET
https://www.googleapis.com/calendar/v3/calendars/MY_EMAIL#gmail.comkey=MY_KEY_HERE: (401) Login Required
Of course, this is all wrong. I don't want the user to need to login. I just can't find any documentation on how to authenticate my app for this scenario. Every guide I come across assumes that the user will be able to sign in so I can access THEIR calendar. But I want the server to login and access a SPECIFIC calendar that belongs to the company.

How to get developerToken for google adwords api?

I've downloaded the PHP client library for Google Adwords API. I need to insert my login details in /src/Google/Api/Ads/AdWords/auth.ini. One of the variable is developerToken.
How can I get it?
Directly from the API...
Your assigned Developer Token will be activated once your application
for API access is approved. Your token will be available through your
AdWords API Center—accessible through the My Account menu for the MCC
account you applied with. You'll be able to access the API by
including it in your request headers when interacting with our system.
It is very important that you keep your Contact Email up to date—we
may send you important information regarding disruptions to service
and urgent changes via this channel.
https://developers.google.com/adwords/api/docs/signingup
I understand this might be old, but since Google updated their API, let me share my experience.
You need to create an MCC account (My Client Center), basically if you already have a Google Adwords account you cannot use it to generate developerToken however, you still can you use same Gmail account to create a new MCC account.
Follow below:
https://adwords.google.com/home/tools/manager-accounts/
Click on Start Now
Probably you are already logged in using your Gmail account, in all cases use your Gmail account in the email address field.
Choose name for your account let's say main-account
Do not click save and continue
Check below picture, you need to click, click here in the message below.
You will then redirect to the main dashboard, where you can click on Tools and then under SETUP tab you will find Adwords API Centre where you will be able to generate developerToken
you have to use the developer token from your live account. The token will work fine even if its status is pending

Sending Facebook messages through their API - possible?

I'm building a web app for a client where members of general public can create an account. Client would like to be able to use my app to send Facebook messages to those members.
Note that my app is a standard LAMP site and NOT a facebook application, nor is there the desire to create one; delivering messages to members' FB inbox is the only goal.
Is this possible, using the FB API or any other way?
In short the answer is no. Facebook do not give you the ability to do this to prevent spam. You could post to all of your user's feeds however?
What you would need to do is:
Register facebook app to get access to FB API. You don't need to have actual facebook app, just use received API key on your standalone site.
Create authentication process on your site so users would be able to connect with your site through facebook.
Ask users for additional extended permissions during authentication to access their email, as it is not something that could be accessed without user's explicit permission.
That's the bare minimum for this task.

Categories