Please login or register to access secure site features.

Note: By continuing to use DevConnect Program Services you agree to our latest Registered Member Terms.

Sign in using DevConnect ID

Forgot password?

Trouble logging in?

Submit a ticket for Registration Support.

I have an SSO ID

?
sign in

Don't have a DevConnect or SSO ID ?

Create a DevConnect account or join the program.

register now
^
New DevConnect members must have forum permissions in order to post messages.
If the Reply and New Post buttons are not available to you, please request access using a General Support request ticket.
Forum Index » Engagement Designer » Trying to use the MS Graph APIs and I can't get a token...   XML
 
Author Message
KyleHodess



Joined: 17/11/2015 12:58:56
Messages: 14
Offline

So, I'm trying to use the Bookings APIs in Office 365. Unfortunately, the only permissions available for Bookings are delegated, so I have to use a username and password as well as a client ID and secret.

I noticed this old post saying something should be added, but I'm on 3.8 and not seeing much around how to use O365 authentication.
https://www.devconnectprogram.com/forums/posts/list/23128.page#p158557

I can get a token in Postman if I HTTP POST to https://login.microsoftonline.com/MyTenantID/oauth2/v2.0/token
and if I pass in the body:
grant_type = password
client_id = myclientID
client_secret = mysecret
scope = https://graph.microsoft.com/.default
username = A user that can use MS Bookings
password = that user's password.

I can then use that auth token to do a HTTP GET on https://graph.microsoft.com/beta/bookingBusinesses/Bookingemailaddress@mytenant.onmicrosoft.com/appointments

And that gets me appointments.

I was trying to do a HTTP POST to the token endpoint with authentication "none" and just pass the parameters along in the payload, but the payload never seems to accept or take the client_id because it seems hard coded to expect that in the OAuth.

So, out of curiosity, anyone have any tips to authenticate against O365 with a rest call to do stuff?

This message was edited 1 time. Last update was at 11/01/2021 12:37:25

KyleHodess



Joined: 17/11/2015 12:58:56
Messages: 14
Offline

Well, I got around Breeze doing the OAuth part by taking my token from Postman and adding it into the REST call I wanted to make not as a OAuth Token but as an additional Authorization header.

I guess cause I'll be running a database underneath anyway that I'll just rig a cron job to a curl script to refresh the token every so often and just make the REST calls read an auth header from the database instead of fighting with the authentication mechanisms in EDP's REST call
Krishnakumar(KK)



Joined: 15/07/2016 13:43:34
Messages: 21
Offline

Hi,
Have you tried "OAuth 2.0" option for http authentication? This option would either use the oAuth token if provided or try to get the OAuth token using the parameters you provide and use it for the http request.

If you have tried with this option and did not work, could please share the error you are getting?

Thanks!
Salgado



Joined: 02/06/2021 04:45:02
Messages: 1
Offline

Microsoft Graph is here to unite Azure and Office 365 data under a single roof. It is a simple REST API and Microsoft provided many examples of how to use it, including an interactive Graph Explorer which allows us to discover the different methods.

MyCardStatement

This message was edited 1 time. Last update was at 03/06/2021 05:08:58

Demarcus14528



Joined: 02/08/2021 00:23:11
Messages: 1
Offline

Since the data we want to retrieve from the Graph API is usually related to specific users, it only makes sense that we need to use Azure Active

NJMCDirect
Daniels551



Joined: 09/10/2021 00:48:10
Messages: 1
Offline

KyleHodess wrote:So, I'm trying to use the Bookings APIs in Office 365. Unfortunately, the only permissions available for Bookings are delegated, so I have to use a username and password as well as a client ID and secret.

I noticed this old post saying something should be added, but I'm on 3.8 and not seeing much around how to use O365 authentication. liteblue
https://www.devconnectprogram.com/forums/posts/list/23128.page#p158557

I can get a token in Postman if I HTTP POST to https://login.microsoftonline.com/MyTenantID/oauth2/v2.0/token
and if I pass in the body:
grant_type = password
client_id = myclientID
client_secret = mysecret
scope = https://graph.microsoft.com/.default
username = A user that can use MS Bookings
password = that user's password.

I can then use that auth token to do a HTTP GET on https://graph.microsoft.com/beta/bookingBusinesses/Bookingemailaddress@mytenant.onmicrosoft.com/appointments

And that gets me appointments.

I was trying to do a HTTP POST to the token endpoint with authentication "none" and just pass the parameters along in the payload, but the payload never seems to accept or take the client_id because it seems hard coded to expect that in the OAuth.

So, out of curiosity, anyone have any tips to authenticate against O365 with a rest call to do stuff?


You can’t hard code an access token. They have to be generated, and they only have a life time of 1 hour from the time they are generated.

 
 
Go to: