Is it possible to integrate with Microsoft’s Graph API?

Has anyone figured out how to finalize a Microsoft Graph API? I’ve seen forum posts where Bubble’s requirement that people use the debug_mode is causing problems as Microsoft doesn’t allow parameters but can’t seem to fix it.

I’m struggling to figure this out as I keep getting an error about the redirect URL. Really needing this for my app.

Do you mean you have problem with oAuth2 with MS Graph?

@Jici , thanks for replying. That’s correct. My call is set up exactly as is needed, but when I try to run in debug_mode via a button workflow, Microsoft gives a “ Reply URL specified in the request does not match the reply URLs configured for the application.”

I’ve seen other Bubblers run into the same issue as Microsoft is, presumably, expecting the URL to not have Bubble’s default debug parameter. Very frustrating and can’t figure out a fix.

Can you share your setting? I can confirm it’s doable because I’ve done this a lot of time in the past.
Share settings in your App in MS and also in API Connector
(A good idea, is to use the generic URL)

@Jici, I figured it had to be. Thanks for taking a look. Here is the API (set to be an oAuth2 user agent flow):

In Microsoft, I’ve registered an app in the Azure Portal and set the redirect URI to be https://myappname.bubbleapps.io/version-test/test, which is the page I’m using to initiate the API.

When I run it, though, Microsoft then gives that “Reply URL specified in the request does not match the reply URLs configured for the application” error.

What’s so strange to me is it authenticates just fine when I run it without the debug_mode parameter that Bubble requires and returns a session ID; Bubble just shows an error alert before it authenticates.

image

This is why I suggest you to use the “Use a generic redirect URL” checkbox and set this generic url into MS Azure. It will work better.
When you use API Connector, it will submit the redirect url with the current page url if the generic is not selected. Most of API will accept that and just remove the parameters from the URL. But a lot of API need an exact match between what you enter in the redirect url in the auth request and what you set in their settings.

You don’t see the auth request settings, but basically, this contain the scope, the redirect url (actually, with your setting, it will use the current page url), the app id and the auth type.

If you wan’t to avoid any error, use the generic redirect url instead

1 Like

@Jici, very interesting! To confirm, I just use the generic URL Bubble displays in my API page?

Exactly. And don’t forget to set it in MS.
This is the easiest fix you can have for this issue. And you will not need to care about adding more url in MS if you use the API in other page or live vs Dev. It will work everywhere.

@Jici, brilliant! Thanks for the info. That worked on the Microsoft side, but when I get into Bubble it’s now saying the following:

image

I thought maybe this meant it had worked previously, but Bubble is also still showing the message about my call not having been tested yet. :frowning:

Any ideas?

Go in your User DB and delete any user with the email of the MS account. Retry.

@eLPDev Did you make it work?

Hey Jici, quick question. I have set up the Microsoft Graph APi, and when the user clicks the login button, they login, but the information isn’t saving in my database. It’s just blank, what am I doing wrong?

Can you share the wf settings?

Hello Jici,

im very interested in this question too. Im still getting error from API. The same settings i tryed successfull with postman but it doesnt working in bubble. Im redirected to o365 login, then MFA, then back to app with error:
image

Please, could you check it?

Thank you!
Best,
Michal

@stoklasa.michal666, check the Use a generic redirect URL in the screen above and then review my API config screen below as your login and access token urls don’t look correct to me. Also, you have to fill out the id and secret for both app id and dev app ids, etc. Otherwise, it’ll never work in development.

Once you do that, you may be having the same issue I was having. What was tripping me up was that if you use the Generic redirect url, you need two different redirect urls in the Azure App registration, one for dev and one for live.

Try adding the two redirect urls below to the Azure app registration. (Hopefully, I copied your app url correctly)
https://bezpecny-nakup.bubbleapps.io/api/version-test/1.1/oauth_redirect (for dev)
https://bezpecny-nakup.bubbleapps.io/api/1.1/oauth_redirect

Once you do all of that, it should work.

Hope this helps!
–Treb

2 Likes

Oh Treb, its working !!

Thank you soo much !!

Michal

1 Like

Woo hoo! Happy to help!

–Treb

1 Like

Hello @treb.gatte, @stoklasa.michal666 and @Jici
Im reading your posts, and im struggling on the MS graph configuration and my bubble app because i need to refresh the token every +/- hour
In fact, i have set up everything (i also have a scenario with integromat with +/- less the same set up for the AUTH), but here, with my bubble app, on the API connector, it still ask to connect again to get a new token ;( see attached the set up - would you mind helping me and let me know what im doing wrong ?
thanks


Hi @Alter345
I have several apps running MSFT SSO (both using ‘common’ authentication and also directly integrated with the clients AD directory. Happy to help you configure this.
Simon

1 Like