Redirect after install to embedded app

Highlighted
Shopify Partner
11 0 7

Hi there, I'm trying to work something out. I have noticed that the App Url in the app settings page is used for both the installation and the main embedded app (when you click on the app name in the admin/apps section).

I have my admin screen working as an embedded app using Polaris, and it works just fine. The problem is that after I install my app, I want the store owner to be redirected to the admin screen embedded in the shopify admin framework. 

Is there a way I can acomplish this?

Thank you!

3 Likes
Highlighted
Shopify Staff
Shopify Staff
1555 81 282

Hey Eliezer,

This will come down to how you handle requests to your app URL. Requests from Shopify to your app URL will include a shop parameter, you can use that shop parameter to determine whether you have a permanent access token for that shop already. If you do, you can serve your app's admin view. If not, you can go through the OAuth motions.

Cheers.

1 Like
Highlighted
Shopify Partner
11 0 7

Thank you Alex. That part I have working. 

My problem was that after the install is done, I want to redirect the user somewhere. I wanted to direct them to the settings page which is embedded in the shopify framework, but I don't know how to do that. I can redirect them to my admin page without a problem, but it's not in the iframe.

Thank you

2 Likes
Highlighted
Tourist
11 0 3

@Eliezer Did you get to any point yet? Seems like i've the same situation

1 Like
Highlighted
Excursionist
39 0 6

@Eliezer Bauer If you use EASDK correctly as documented, it will always check and redirect an embed app to shop Admin.

Keep your customers informed with the best deals, sales events, announcements... https://apps.shopify.com/sticky-promo-bar
1 Like
Highlighted
New Member
1 0 1

@Eliezer  Did you get to any point yet? 

1 Like
Highlighted
Shopify Partner
1 0 3

@Elizer You can try xxx.myshopify.com/admin/apps/API_KEY where API_KEY is your apps unique API key

3 Likes
Highlighted
Shopify Partner
30 0 1

Can you please explain how to do the following: 

 

"you can use that shop parameter to determine whether you have a permanent access token for that shop already. If you do, you can serve your app's admin view. If not, you can go through the OAuth motions."

 

 

im trying to do this on my app but it always starts the OAuth process eventhough the entry exists in my database. My code looks something like this:

 

// request.query("select * from table_name where shop_name = '" + shop + "'", (err, recordset) => {	
				// 	if (err){
				// 		console.log(err)
				// 	} 	else{
				// 		if(recordset.recordset.length > 0){
				// 				console.log("installed")
				// 				 ctx.redirect("/")
				// 				 return true;
				// 		}else{
				// 				console.log("not installed")
				// 		}
						
				// 	}            
				// });

 

				

as you see im redirecting to the app but for some reason it still does the OAuth process and another entry gets added....do you know what im doing wrong?

0 Likes