I'm working on a project in which I need to create events in my calendar, for this I am using the GRAPH API and there should be no user interaction. I'm using my personal account.
As a test I am making a call in Postman to which I add the token I got from the URL
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
https://graph.microsoft.com/v1.0/users/me/events
{
"subject": "My event",
"start": {
"dateTime": "2020-06-22T13:32:53.037Z",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-06-29T13:32:53.037Z",
"timeZone": "UTC"
}
}
But I'm getting this error
{ "error": { "code": "NoPermissionsInAccessToken", "message": "The token contains no permissions, or permissions can not be understood.", "innerError": { "requestId": "b4ffb07b-8a7b-4893-93ae-1a3bb8be8f28", "date": "2020-06-23T03:14:49", "request-id": "b4ffb07b-8a7b-4893-93ae-1a3bb8be8f28" } } }
This is my token's body
These are the app permissions
Is this error because I don't have the admin consent or l'm doing something wrong?
Did you register your app in Azure AD?
Please follow steps described here:
https://learn.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0&view=graph-rest-1.0
Permission level you need is Calendar.ReadWrite
Related
Konrad Eichstädt
07.11.2021, 11:50:00 (gestern)
an AdWords API and Google Ads API Forum
Hi There,
I'am trying to develop a smart home addon to reading google tasks. I tried this using the OAUTH2 Flow for limited devices
https://developers.google.com/identity/protocols/oauth2/limited-input-device
I got successfull an access token but can't using them because of the following error:
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
{
"message": "Insufficient Permission",
"domain": "global",
"reason": "insufficientPermissions"
}
],
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
"domain": "googleapis.com",
"metadata": {
"method": "google.apps.tasks.data.v1.TaskListService.Get",
"service": "tasks.googleapis.com"
}
}
]
}
I this correct that limited devices can't reading google tasks?
Many Thanks,
Konrad
I login in my ionic2 app in facebook and get response like this:
{
token: "iuiouoi.weewe.weioioioi", // this is example token
signup: "false"
}
And can get user id.
Then I want store user id in my database and send this token and user id to the server. I want check token and user id on server and make this request:
https://graph.facebook.com/me?access_token=iuiouoi.weewe.weioioioi
But after this request I have exeption:
{
"error": {
"message": "Bad signature",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "Bg4sWambfPx"
}
}
Can I check user id and this token for complience in my server, after login in application?
As per my understanding please read:-
Facebook Graph API giving an unknown OAuthException
"message": "An unknown error has occurred.", "type": "OAuthException", facebook sdk 4 php
If these also not work than read this link because its also a bug in FB.
https://developers.facebook.com/bugs/486654544831076/
i am trying to use google api explorer to first try to insert an object to google cloud storage.
the request looks like
POST https://www.googleapis.com/storage/v1/b/visionapibucket/o?key={YOUR_API_KEY}
{
"contentType": "image/jpeg",
"uploadType": "media",
"path": "/upload/storage/v1/b/visionapibucket/o"
}
but i see the error as
400 HTTP/2.0 400
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required"
},
{
"domain": "global",
"reason": "wrongUrlForUpload",
"message": "Upload requests must include an uploadType URL parameter and a URL path beginning with /upload/",
"extendedHelp": "https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload"
}
],
"code": 400,
"message": "Required"
}
}
not sure what i am missing. please advise
Looks like a bug on the website. It doesn't seem like the explorer supports media.
The request it generated looks like:
POST https://www.googleapis.com/storage/v1/b/visionapibucket/o?key={YOUR_API_KEY}
But a proper upload request would look like:
POST https://www.googleapis.com/upload/storage/v1/b/visionapibucket/o?key={YOUR_API_KEY}&uploadType=media&name=myfile.jpeg
You'll also want to include a "Content-Type" header specifying that it's a JPEG image.
There's a guide on the various ways to upload objects using the JSON API here. The specific type you're looking for is like a simple upload.
I have to post json to api_url for login.
{
"username":"testre","password":"password"
}
When I use postman to check this api, it reply successful authentication like below.
{
"status": "success",
"code": 200,
"message": "username, password validated.",
"data": [
{
"password": "password",
"username": "testre"
}
],
"links": [
{
"rel": "self",
"link": "http://localhost:2222/pizza-shefu/api/v1.0/customers/login/"
},
{
"rel": "profile",
"link": "http://localhost:2222/pizza-shefu/api/v1.0/customers/testre"
}
]
}
For an unauthorized json like below.
{
"status": "unauthorized",
"code": 401,
"errorMessage": "HTTP_UNAUTHORIZED",
"description": "credentials provided are not authorized."
}
Previously I code to retrieve it using java. But now I want to refactor it using RestTemplate in spring. The problem is every example I read is written for fixed number of variables https://spring.io/guides/gs/consuming-rest/. Here I get different numbers of variable according to the login success status. I am new to spring so I'm confused in creating the class for login reply which we get from rest template. (Such as this in the example Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); But I need to return a json object). I couldn't figure out how to write the RestTemplate part.
As suggested by #Andreas:
Add the superset of all fields for all possible responses
Identify the set of fields that are mandatory for every response and make them required
Make the rest of the fields as optional
Upon receveiving a response, check the status code and implement your logic accordingly.
If you are using Jackson for Deserialization, all fields are optional by default (see this question)
As I'm using oauth2.0 to get the user details it is working correct and giving correct credentials in android above 4.0 version.But when coming to android 2.3.6 it returning the following error credentials.As I'm using scope
public static final String SCOPE = "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email";
.But at some time working fine when I'm signing with new account and next time when I'm choosing account from account chooser it returning the following
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
As i verified this credentials with following url
https://www.googleapis.com/oauth2/v1/userinfo?access_token={"our access token"}