Checkout and Transaction API Permissions error - api

I am currently trying to create a transaction or checkout from Postman, I set the Header with a full access token but the API always response:
{
"errors": [
{
"category": "AUTHENTICATION_ERROR",
"code": "FORBIDDEN",
"detail": "You have insufficient permissions to perform that action."
}
]
}
Attach the OAuth screen.Permissions image
and the postman request. https://www.getpostman.com/collections/4fe6fec54384fc10d152

Unfortunately, this is due to you not being in one of the countries currently available to Square's APIs: https://docs.connect.squareup.com/articles/faq-international-availability?q=country. You will not be able to make payments using the API when outside of the countries listed above.
Furthermore, you should never share your personal access token with anyone (which you show in your screenshot). Please change this immediately, by navigating to your Square dashboard and clicking "Replace" on your "Credentials" tab.

Related

Http delete request to Google Directory API returning 412 Precondition is not met: location If-Match

I have been using Postman to send http requests to Google's Directory API. The GET request works fine (which shows that the admin token as well works fine) to get info for a user.
But, what I need to do is delete the user, and when I try this, I get the following back:
{
"error": {
"code": 412,
"message": "Precondition is not met.",
"errors": [
{
"message": "Precondition is not met.",
"domain": "global",
"reason": "conditionNotMet",
"location": "If-Match",
"locationType": "header"
}
]
}
}
I was presupposing that I was missing the etag, which is what I added from the user, but it did not work. I also tried adding "*" to the If-Match tag, and that did not work either. Maybe there is a way with a put or patch request?
The API reference is this: https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/delete
The API does not work on Google's reference page either. I have also tried this in multiple domains where I am the super-admin so the error is not related to a specific super-user or domain.
I have also made sure, in multiple tests, that the user I am trying to delete is not an admin of any type.
I am adding images below to show that the GET api works fine. So I just need to know how to format the API request to be able to delete the user.
Ok, after talking directly to Google and even seeing that Jay Lee (author of GAM) ran into the same problem, we found out that you can't delete a user if:
It has a license of some sort
It's an admin
It has a Google Vault retention rule applied
To be able to delete a user from now on, you must remove all these things (licenses, admin privileges, Vault retention rules) or you must transfer the information of that user to another user (along with whatever else Google asks you to remove beforehand).
The "Precondition is not met" is vague and Google should change this, but it means that one of the three things above have not been removed yet.
Below I am adding multiple links to confirm what I mentioned above as well as the APIs you need to use on users before being able to delete them.
https://groups.google.com/g/google-apps-manager/c/83kR-4MoPk0?pli=1
https://github.com/GAM-team/GAM/releases?gam-releases
https://developers.google.com/admin-sdk/data-transfer/reference/rest/v1/transfers#DataTransfer
https://developers.google.com/vault/guides/holds#python
https://developers.google.com/vault/reference/rest/v1/matters.holds.accounts/list

Xero API Forbidden getting Item

This only happened in the past few days that I am having this issue but only for getting an Item. I can get contacts and get branding themes. Therefore, tenand id is working and accesstoken.
This is the endpoint when i'm getting item:
https://api.xero.com/api.xro/2.0/Items/SHO B 100 S
Response:
{
"Type": null,
"Title": "Forbidden",
"Status": 403,
"Detail": "AuthenticationUnsuccessful",
"Instance": "94aa22f4-6ba1-43f6-8f76-699befb1b1f3",
"Extensions": {}
}
And this is the scope:
offline_access accounting.transactions openid profile email accounting.contacts accounting.settings
I am not sure what had changed but everything is working except getting an item. Please tell me how can I fix this and what causes the issue. Thank you so much in advance.
Couple of things you can confirm to debug this.
You have a valid, refreshed access_token (Can you make api calls to any other endpoints? is the JWT's "exp" > than current time?)
Did you add the scope after you generated the initial token? (To test, completely clobber the token set, and re-generate a new one going through the OAuth2 flow)
The query looks correct. The screenshots are when I query an item with a code that exists and doesn't. You should get a 404 if not found not a 401 so I def think its something in #1 or #1

google oauth2 discovery return wrong token_endpoint

Here is the google oauth2 discovery url.
https://accounts.google.com/.well-known/openid-configuration
And in the response, it looks like this
{
"issuer": "https://accounts.google.com",
"authorization_endpoint":"https://accounts.google.com/o/oauth2/v2/auth",
"token_endpoint": "https://oauth2.googleapis.com/token",
"userinfo_endpoint": "https://www.googleapis.com/oauth2/v3/userinfo",
"revocation_endpoint": "https://oauth2.googleapis.com/revoke",
"jwks_uri": "https://www.googleapis.com/oauth2/v3/certs",
...
The token_endpoint in the google document here https://developers.google.com/identity/protocols/OAuth2WebServer#exchange-authorization-code said it should be https://www.googleapis.com/oauth2/v4/token.
Maybe recently the token_endpoint is updated, but when I use https://oauth2.googleapis.com/token this one to exchange token with code., I will get an error response.
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } }
And if I use https://www.googleapis.com/oauth2/v4/token to do the same thing, everything is fine.
Is there anything changed in google identify platform? Thanks!
The OAuth endpoint has been updated a number of times over the last five years. I normally follow the one i the discovery doc but your example shows that that is not always the best course of action all of the time.
I have never heard of google shutting down old endpoints i suggest you use the one that works. As a side note i will contact Google to see if i can get some feed back as to why one call worked and the other didnt.

MS Graph API: microsoft.graph.createLink not creating anonymous view links

I'm using graph API to iterate over a folder in OneDrive for Business. I'm attempting to generate "anonymous view" links for each item in the folder using the following call:
/v1.0/users('user-guid')/drive/items/item-id/microsoft.graph.createLink
with the body:
{
"type": "view",
"scope": "anonymous"
}
This works correctly for items that have already been given the "View link- no sign-in required" permission via the OneDrive UI. However, executing this call against an item that doesn't have this sharing option already set, results in the following return message:
{
"error": {
"code": "unauthenticated",
"message": "The caller is not authenticated.",
"innerError": {
"request-id": "1c3600ec-4861-4be4-9a7b-74264f488a80",
"date": "2016-03-13T02:30:10"
}
}
}
I know that this is not an authentication issue because my token works fine for all other calls (and calls against items that already have their file sharing set). I get the same behavior from the Microsoft Graph Explorer tool. If I manually set the "View link - no sign-in required" permission in OneDrive this call executes perfectly. My credentials for the API call are the same credentials I'm using to set the permissions in the OneDrive UI.
The documentation for microsoft.graph.createLink states
The createLink method will create a new sharing link if the specified link type doesn't already exist. If a sharing link of the specified type already exists for the app, the existing sharing link will be returned.
Any ideas what's going wrong here?
The url should be simply /createLink (without the microsoft.graph prefix):
POST /me/drive/items/{item-id}/createLink

Can I still authorize requests with the YouTube v3 API without using OAuth?

Google recommended I ask questions about their API here.
I've been testing out v3 of the YouTube API. Sometime this week, it appears have made a yet-to-documented behavior change. Before, I could just put "key=$foo" in my URLs to authenticate them, which is all I need for my simple server-side use. The documentation included example URLs using this Authorization method, like this one:
https://www.googleapis.com/youtube/v3alpha/videos?id=7lCDEYXw3mM&key=API_KEY&part=id,snippet,contentDetails,statistics,status
(from here.)
Now when I try this method, instead of getting back a successful response, I get this:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
If the currently documented syntax isn't going to work anymore, what's the next-based simple authorization option to use?
Thanks!
The key=API_KEY URL parameter should still work for v3 in general, whenever you're making an unauthenticated request.
The engineering team is in the middle of pushing out some breaking changes to the backend services, though, and they broke this functionality in the meantime. I'd expect it to be fixed sometime soon—it's difficult to do anything using v3 at the moment.