Solved

Connection to Microsoft Graph API

  • 15 August 2018
  • 8 replies
  • 38 views

Badge +21

Have anyone managed to connect to Microsoft Graph API? I am thinking about the authentication part

 

https://developer.microsoft.com/en-us/graph

The authentication is described here: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_overview

Any help?

icon

Best answer by gerhardatsafe 21 August 2018, 03:12

View original

8 replies

Badge
@sigtill

I uploaded a Microsoft Graph Web Connection to the FME Hub:

 

https://hub.safe.com/web_connections/microsoft-graph

 

 

You will need to create an app here to use the Web Connection: https://apps.dev.microsoft.com/

Once you add your client ID and client secret you can use the Web Connection as authentication in the HTTPCaller.

Badge +21
@sigtill

I uploaded a Microsoft Graph Web Connection to the FME Hub:

 

https://hub.safe.com/web_connections/microsoft-graph

 

 

You will need to create an app here to use the Web Connection: https://apps.dev.microsoft.com/

Once you add your client ID and client secret you can use the Web Connection as authentication in the HTTPCaller.

Spot on Gerhard! I always forget the web-connections. And I havent used it a lot. I am guessing its also possible to create a similar web-connection towards Leica Conx (https://knowledge.safe.com/questions/65547/data-tofrom-leica-conx.html) - I will have a dive into that when there is some spare-time!

 

 

Badge +21
@sigtill

I uploaded a Microsoft Graph Web Connection to the FME Hub:

 

https://hub.safe.com/web_connections/microsoft-graph

 

 

You will need to create an app here to use the Web Connection: https://apps.dev.microsoft.com/

Once you add your client ID and client secret you can use the Web Connection as authentication in the HTTPCaller.

It seems the token times out after 1 hour and I need to sign in again - is there an error in the refresh-token string? @GerhardAtSafe

 

Badge +21
@sigtill

I uploaded a Microsoft Graph Web Connection to the FME Hub:

 

https://hub.safe.com/web_connections/microsoft-graph

 

 

You will need to create an app here to use the Web Connection: https://apps.dev.microsoft.com/

Once you add your client ID and client secret you can use the Web Connection as authentication in the HTTPCaller.

I also added a comment regarding changing scope: https://hub.safe.com/web_connections/microsoft-graph

 

 

NB! Remember to change the scope to suit what you need access to: for instance mail.read or calendars.read etc. If not - it will not work. And documentation is available here: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/beta-overview

 

 

Badge
I also added a comment regarding changing scope: https://hub.safe.com/web_connections/microsoft-graph

 

 

NB! Remember to change the scope to suit what you need access to: for instance mail.read or calendars.read etc. If not - it will not work. And documentation is available here: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/beta-overview

 

 

It's a good point, I'll add this to the description.

 

 

Badge
It seems the token times out after 1 hour and I need to sign in again - is there an error in the refresh-token string? @GerhardAtSafe

 

There could be 2 reasons for this:

 

1. The redirect URI is missing in the refresh token request. We add it automatically to the retrieve token request, but not to the refresh request. You can try to add it as a query string to the token request. This is the example I followed by the way:

 

https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

 

 

2. You might need to grant the offline_access scope for your app the successfully retrieve refresh tokens:

 

https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-id-and-access-tokens#refresh-tokens

 

 

Let me know if you get a chance to test these 2 options. I will update the Web Connection on the Hub as soon as get to it so if you can confirm a fix by then that would be really helpful.

 

 

Thanks!

 

There could be 2 reasons for this:

 

1. The redirect URI is missing in the refresh token request. We add it automatically to the retrieve token request, but not to the refresh request. You can try to add it as a query string to the token request. This is the example I followed by the way:

 

https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

 

 

2. You might need to grant the offline_access scope for your app the successfully retrieve refresh tokens:

 

https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-id-and-access-tokens#refresh-tokens

 

 

Let me know if you get a chance to test these 2 options. I will update the Web Connection on the Hub as soon as get to it so if you can confirm a fix by then that would be really helpful.

 

 

Thanks!

 

You have to insert the "redirect_uri" as an URL, I tried with [REDIRECT_URI] at the Refresh Token Parameters - Request Format, but it didn't worked.

 

 

Badge +21
You have to insert the "redirect_uri" as an URL, I tried with [REDIRECT_URI] at the Refresh Token Parameters - Request Format, but it didn't worked.

 

 

@GerhardAtSafe - as @arnebrucksch says you need to add the redirect_uri as an URL.

 

Reply