Redirect to oauth after app installation?

Hi there,

I created a new monday app, and setup scopes and redirect urls in the oauth section of my app settings.

When I launch my app server locally, and click “login” (which redirect to the monday authorize url), I can successfully authorize the app:

After I’ve done that, the app is not installed in my workspace though.

When I install the app via the “Manage → install” button in my Developer Center account, it installs the app, but it never triggers my oauth endpoint.

So I’m wondering how app installations and oauth is connected?

Idially, whenever a user installs the app (via the marketplace), I would like the app to redirect to my oauth endpoint (so that I get the token to make api calls), then I would redirect back a board that I created via api. Is that possible?

I think I found a way that somewhat works for my use case:

I use the “Workspace template feature” to create a folder, a board for my app, and a Doc with instructions on how to use my app. Within that Doc, there is a link to “http://myapp.com/connect” which will trigger the oauth flow, and I tell users to click the link before using my app.

It’s not ideal though. What if the user doesn’t click the link?

I found this quote in the api docs:

You can set up OAuth for your app in two distinct phases: configuring your app and going through the standard OAuth flow.

I think this is what I want. How can I trigger the oauth flow after someone installs my app @Matias.Monday ?

Hello there @wnm,

What app features does your app have?

Looking forward to hearing from you!

Cheers,
MAtias

I’m building a page builder type app, where users have a board, and each item represent a “page”, the content of the page will be stored as a Monday doc column.

I want to use the api to pull the data out from a user’s workspace, und render the page for them.

I’m not yet sure if I need any specific Monday app features. I’m probably going to use the ‘item view’ feature, so users can preview a page right there in their board.

Hello again @wnm,

If you will have an item view feature, then you can just display the “OAuth request” view for which you can get the link in the OAuth section of your app inside “Redirect URLs”.

When the user opens the item view, you can check if you already have an OAuth token for that user. If you do, you can redirect to the app. If you don’t you can redirect to the OAuth request view and get it.

Is that what you needed?

Looking forward to hearing from you!

Cheers,
Matias

Hi @Matias.Monday,

thanks for your reply!

That’s not exactly what I need, no. I would like to get the token right from the start, not just when a user opens an item. The reason: as soon as the app is installed I want to setup their website, and need to make api requests right from the get go.

I found that when you use an integration for sentence builder feature I can add an autzorization url, which will be used for the oauth. If I then add the integration feature as a starting point for the app, the oauth will be triggered right after install. Which is exactly what I want.

The only problem with that solution is, that I then no longer can use a specific template as a starting point. :frowning:

I then tried something else.

I added the automation to the template that I’m using as a starting point:

The board which I added the automation, is used as a starting point in my app:

I then switched to a different account, installed the app, and clicked on “Use App”:

This triggered the onboarding flow, which successfully copied the template to my workspace, and added the automation that I’ve setup.

I did not trigger a oauth request though.

So when the automation triggered (by creating a new item), I received the request on my server, but couldn’t make an api call because I didn’t have a valid access token.

In my opinion, the puzzle piece that is missing is a standalone “connect via oauth” feature, similiar to what is included in the “integration for sentence” feature, which triggers an oauth flow, after the installation of an app.

It could also include a backToUrl param, which we could use to redirect the user back to finish the onboarding…to whatever we have setup as the starting point (specific feature, or template).

Hello again @wnm,

Thank you for the thorough explanation!

Then I believe this is a great request for our team to consider :smile: