authorize user using wechat php - php

recently tried to use Wechat authentication for my PHP web application but when i try to get auth token it gives me  Error : {"errcode":50001,"errmsg":"user unauthorized hint: [_ue8GA0843e277]"}
I am calling https://api.wechat.com/cgi-bin/token?grant_type=client_credential&appid=wxa1dc8d55458d****&secret=39efd8a98ae56d4f70842527346a**** to get auth token

Errorcode : 50001 states - Unauthorized access.
This error will happen when the official wechat account is not verified. After verification only you will be able to get the access to the APIs.
You can easily check this, by accessing the wechat account. Under developer section click on Interface and permission. Here it will provide list of info related to wechat API whether it is "obtained" or "not obtained" under "status". Those that contain the status "Obtained" alone will work and rest wont work.

Related

DocuSign API update envelope notification settings

I am using the PHP SDK. I created a user account under my admin account. I use "send on behalf of" to send envelopes from the user account. I am able to check the status of and download completed envelope documents and tab data with the master account, but I am unable to update the envelope notification settings from the master account.
The error I get is:
"errorCode": "USER_LACKS_PERMISSIONS",
"message": "This user lacks sufficient permissions to access this resource."
Am I unable to update the notification settings on behalf of another user through the API? Here is the relevant code snippet:
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient);
$expirations = new DocuSign\eSign\Model\Expirations();
$expirations->setExpireAfter('120');
$expirations->setExpireEnabled('true');
$expirations->setExpireWarn('0');
$reminders = new DocuSign\eSign\Model\Reminders();
$reminders->setReminderDelay('5');
$reminders->setReminderEnabled('true');
$reminders->setReminderFrequency('5');
$envelope_notification_request = new DocuSign\eSign\Model\EnvelopeNotificationRequest();
$envelope_notification_request->setReminders($reminders);
$envelope_notification_request->setExpirations($expirations);
$envelope_notification_request->setUseAccountDefaults('true');
$envelopeApi->updateNotificationSettings($accountId, $id,
$envelope_notification_request);
This is when I get an error. I have tried using SendOnBehalfOf in the headers and without, with no change in results. Does anyone know if it is simply not possible to update the notification settings on behalf of another user with the API?
Thank you
OAuth JWT Grant is the recommended authentication technique instead of the old SOBO system. See https://github.com/docusign/eg-01-php-jwt for an example of how to do this.
That probably isn't the issue but can only help.
The best would be to set the notification parameters when you create the envelope.
Another possibility: when you try to set the notification parameters are you sure that the envelope is not complete?
Next idea: use the API Logging system to see exactly what was sent to DocuSign. Check it against the API reference page for that call as a check that the call is being made correctly.
Finally, I don't understand why you're requesting the account defaults and also trying to set the notification parameters. Wouldn't it be one or the other?

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.

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

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

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.

Google account: Can retrieve the picture from openid? Can I get it with OAuth to google?

I need to retrieve the name, email and picture from a google account.
I am already using the openid to make the user login with it's google acc.
Can I have the picture URL from the openid proccess?
with OAuth I cant'seem to find the right scope to retrieve this information... See this link:
http://code.google.com/apis/gdata/docs/directory.html
there is a list of scopes that you can fetch with REST api to google and I didnt't see the one related to the profile.
Btw, I am using PHP and the openid is already working, but didn't start with the oauth untill I know if I can(and need) retrieve the picture (because email and name already comes within the openid proccess)
thanks,
Joe
It seems that you can retrieve the picture URL with the Google Contacts Data API : see http://code.google.com/intl/fr/apis/contacts/docs/3.0/developers_guide_protocol.html#retrieving_photo
Then you must authenticate your requests with OAuth. If you already use OpenID, you can now use the hybid protocol OpenId/OAuth : see http://code.google.com/intl/fr/apis/accounts/docs/OpenID.html#oauth

Categories