Getting Forbidden 403 error while creating OnlineMeeting using Microsoft Graph api - api

I am trying to create online meeting through https://graph.microsoft.com/beta/communications/onlineMeetings .
initially i got the 403 Forbidden error. then i give the Delegated and Application permissions(OnlineMeetings.ReadWrite,OnlineMeetings.ReadWrite.All) on my registered app on azure.then 403 error is gone and i got new error 400 bad request(Organizer.Identity.User.Id missing).
then i supply Online meeting post request as follows-:
{
"startDateTime":"2020-04-20T14:33:30.8546353-07:00",
"endDateTime":"2020-04-20T15:03:30.8566356-07:00",
"subject":"Application Token Meeting",
"participants": {
"organizer": {
"identity": {
"user": {
"id": "cb6d6636-1c9e-457c-b904-5da8265a8927"
}
}
}
}
}
again i got 403 Forbidden error.
i created user with the help of https://graph.microsoft.com/v1.0/users and https://graph.microsoft.com/beta/invitations.
user is created in my app on azure and i give the permission (User.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All,User.ReadWrite.All, Directory.ReadWrite.All)
but error(403) did not change.
My question is that how to give user authorization in microsoft graph API.

The required permission is Delegated Permission: OnlineMeetings.ReadWrite. See reference here.
403 error means your access token doesn't include the required permission. You can add it like this:
Don't forget to click on "Grant admin consent for {your tenant}".
You should implement Get access on behalf of a user and get an access token to call /communications/onlineMeetings endpoint.
The http sample for your reference:
POST https://graph.microsoft.com/beta/communications/onlineMeetings
Content-Type: application/json
Authorization: Bearer {access token}
{
"startDateTime":"2019-09-09T14:33:30.8546353-07:00",
"endDateTime":"2019-09-09T15:03:30.8566356-07:00",
"subject":"Application Token Meeting",
"participants": {
"organizer": {
"identity": {
"user": {
"id": "550fae72-d251-43ec-868c-373732c2704f"
}
}
}
}
}
You can learn more details about Use the access token to call Microsoft Graph. Don't forget to put Authorization: Bearer {access token} in the request headers.

Related

Citrix: Bad Request on refreshing the access token for ShareFile

We have been using ShareFile API for downloading the Citrix Attachment. We are using Oauth 2.0. The general flow is - our clients will authorize the our Citrix ShareFile App to grant permission for accessing their files. OUr ShareFile app should already have the required permission\scopes because with the same app we are successfully downloading attachment files of our customers. However, we are having some problem with a client.
When we tried to get Share items of this client with the access token, we are getting the following error:
Request:
https://clientdomainname.sf-api.com/sf/v3/Shares(se552cbfffda144619419696b8b12f88b)/Items
Response:
{
"code": "Unauthorized",
"message": {
"lang": "en-US",
"value": "You must log in to view this link."
},
"reason": "NotAuthenticated"
}
And when we tried to refresh the access token, we got the Bad Request (error code 400) with invalid_grant error using the refresh token
Request:
https://clientdomanname.sharefile.com/oauth/token
Response:
{
"error": "invalid_grant"
}
Any help would be highly appreciated!

google translate API authorisation problem

I am trying to translate some text using GCP translation service with REST api https://translation.googleapis.com/v3
I'm using API key auth method.
url and
Body
https://translation.googleapis.com/v3/projects/my-translator-1122333:translateText?key=thisismykey
{
"content": ["Hello"],
"sourceLanguageCode": "en",
"targetLanguageCode": "ru"
}
However I got
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Could anyone explain me what is wrong I do?
Thanks

Invalid Authentication Token when using Microsoft OneDrive REST API

I'm trying to integrate my app with OneDrive. I'm following this tutorial: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/?view=odsp-graph-online For oauth I'm using Azure AD v2.0 endpoint.
To get the access token, I'm calling https://login.microsoftonline.com/common/oauth2/v2.0/token and it successfully answers with some json:
{ token_type: 'Bearer',
scope: 'onedrive.readwrite',
expires_in: 3600,
ext_expires_in: 3600,
access_token: '...',
refresh_token: '...' }
When using the access_token that I received to call https://graph.microsoft.com/v2.0/me/drive/root/delta, I get this response:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: 8004920A",
"innerError": {
"request-id": "5eda75b0-c2d5-467f-a728-8006490c00b2",
"date": "2019-08-19T15:56:10"
}
}
}
This error is pretty cryptic and for the life of me I can't work out why that token won't work with this endpoint. Can someone help?
Never mind -- needed to set the scope as files.readwrite.all instead of onedrive.readwrite

Magento 2 rest api throws 401 Unauthorized error

I have create a user role in Magento 2 and a new user
image capture
I used in Chrome the application Postman:
In the GET box: http://example.com/php.index/rest/V1/products/
In Type use Basic Auth with Username and Password
But I get this status '401 Unauthorized' and this requests:
{
"message": "Consumer is not authorized to access %resources",
"parameters": {
"resources": "Magento_Catalog::products"
}
}
I can login in Magento backend with the user and password
Any solution?
You need to pass basic Authorization with access key in header:
Step 1:
Call API: /V1/integration/admin/token with parameters:
username=your_admin_username
password=your_admin_password
This will give you an access key like at0o6w5rhno6sltcuhf3****k0603l
Step2:
Call API : /V1/products/ with parameters
searchCriteria=*
Put **Header**
Authorization : Bearer at0o6w5rhno6sltcuhf3****k0603l
Content-Type : application/json

Google + access token insufficient permission

Using OAuth code i am able to generate access token for google+ API .
using this access token in oauthpalyground iam getting JSON response .
When I paste this this URL into a browser am get an error message.
https://www.googleapis.com/plus/v1/activities?query=%22great%22&access_token=xxxxxxxxxxx
Error Message
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Can anyone explain to me why?
You can not query directly from browser sending the access_token as a querystring. You must send access_ token in headers this way:
Authorization: Bearer <access_token>
Try it with Fiddler or some similar software.