I just ran the command below on my newly created app and get Authorization Failed message. I ran the Token Debugger and the access token is good. How do I fix this?
https://api.pinterest.com/v1/me/pins/?access_token=<ACCESS-TOKEN>&fields=id,creator,note&limit=1
Response:
{
"status": "failure",
"code": 3,
"data": null,
"message": "Authorization failed.",
"endpoint_name": "get_own_pins"
}
You need to include your access token with the api.pinterest.com url
https://api.pinterest.com/v1/me/pins/?
access_token=<YOUR-ACCESS-TOKEN>
&fields=id,note
&limit=1
Replace <YOUR-ACCESS-TOKEN> with your pinterest access token
Related
I need to create a new user using postman
I use the address: http://localhost:1337/api/users, make a POST request to it with the following data:
{
"data": {
"username": "Rafael",
"email": "rafael#rafael.com",
"password": "1234",
"confirmed": false,
"blocked": false
}
}
But I get
{
"data": null,
"error": {
"status": 500,
"name": "InternalServerError",
"message": "Internal Server Error"
}
}
And in VS Code I get: error: Forbidden access
What could it be?
Forbidden access 403, can be caused by several things:
You didn't pass API token (jwt) to the request header (Bearer token)
You have to allow the user/admin role to access User collection.
You can find all the config in the Admin Panel Settings menu.
Create and manage API token in Strapi: https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/api-tokens.html#api-tokens
Configure admin role access: https://docs.strapi.io/user-docs/latest/users-roles-permissions/configuring-administrator-roles.html
Configure end-user role access: https://docs.strapi.io/user-docs/latest/users-roles-permissions/configuring-end-users-roles.html
Hope it helps!
Getting this error (using social_django) i.e. load_backend, load strategy on Facebook login.
How can I remove the appsecret_proof from URL if possible, because when I hit the URL without appsecret_proof? It gives response 200.
The graph Facebook URL is automated generated by Facebook, I guess.
P.S: The same API is working for Google Login
The error:
{
"error": {
"message": "Invalid appsecret_proof provided in the API argument",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "A3pQN70RqFZz5j2i2zheaxd"
}
}
I have dug through most of stackoverflow posts to find an answer but still unable to solve this problem. This is just a simple matter of authing into the gmail api but I want to do it in a server so I need to follow the server-server (OAuth2.0 2 legged procedure). Anyways
I have gone through all the oauth docs in google api .
This one is spot on but it does no good.
https://developers.google.com/gmail/api/auth/web-server.
I have a service account and I do have the creds file.
here is my code snippet.
def call_gmail():
SCOPES = ['https://www.googleapis.com/auth/gmail.readonly']
SERVICE_ACCOUNT_FILE = '<creds_file>'
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
print(credentials)
service = build('gmail', 'v1', credentials=credentials)
messages = ListMessagesMatchingQuery(service, "me", "<Some email address>")
message_id = messages[0]['id']
I keep getting this error:
An error occurred: <HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/me/history?startHistoryId=2547406&alt=json returned "Bad Request">
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Would be very grateful if someone can help me solve this. thanks.
The gmail api only works with service accounts if its a Gsuite account and you have set up domain-wide delegation. Contact your Gsuite admin and make sure that they have setup delegation properly.
delegating authority
I'm using Google Play Android Developer API. I access it from server with service account. I have private key and got access token with it.
I use scope https://www.googleapis.com/auth/androidpublisher. And when I ask subscription info, I got 401 error:
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "permissionDenied",
"message": "The current user has insufficient permissions to perform the requested operation."
}
],
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation."
}
But when I use other queries with the same token and with the same scope, I got successfull responses. For example, I can successful get voided purchases list or info about inapp product:
200 OK
{
"packageName": "com.myapp.exapmle",
"sku": "subscr_month",
"status": "active",
"purchaseType": "subscription",
"defaultPrice": {
"priceMicros": "149000000",
"currency": "RUB"
}
What could be the cause of the problem? I added this service account to developer console and provided all permissions (administrator access).
I'm using the API Explorer tool to create some request urls for google adsense. Here is the request url that the explorer tool generated that gives a response of today's earnings: https://www.googleapis.com/adsense/v1.4/reports?startDate=today&endDate=today&accountId=MY_ACCOUNT_ID&metric=EARNINGS&key=MY_API_KEY
However, when I try to use this url in the browser or in my code it gives this response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
I am not sure what I am missing it use this url. I have activated adsense apis on my google developer console.
The key parameter is the public API key for accessing public data.
The access_token parameter is used for accessing private user data.
In your case you are trying to access your private account and should be using an access token.
To obtain an access token you need to authentication your application using either Oauth2 or a service account. Once you have obtained an access token and send that with your request as so:
https://www.googleapis.com/adsense/v1.4/reports?startDate=today&endDate=today&accountId=MY_ACCOUNT_ID&metric=EARNINGS&access_token=YourAccessToken
You need to replace MY_API_KEY with your API key, and MY_ACCOUNT_ID in same fashion.