Enables any web app using Spring Security to operate as a Shopify embedded app.
This application enables any Spring web application with Spring Security to become a Shopify app and use Shopify’s default OAuth offline access token.
If you’re using the Spring Boot security starter, this translates to version 2.2.X.
Once you have a development store, create a private app.
Now that you’ve created your app, you’re given an API key and an API key secret.
.properties
file.
ppublica.shopify.security.client.client_id=your-key
ppublica.shopify.security.client.client_secret=your-key-secret
ppublica.shopify.security.client.scope=scope1,scope2,...
.properties
file:
ppublica.shopify.security.cipher.password=your-password
If you’re using Maven, add the following under the <dependencies>
element in the pom.xml:
<dependency>
<groupId>com.ppublica.shopify</groupId>
<artifactId>shopify-embedded-app</artifactId>
<version>1.0.0-RELEASE</version>
<scope>compile</scope>
</dependency>
@ComponentScan(basePackages = {"com.ppublica.shopify.security"})
ApplicationContext
:MappingJackson2HttpMessageConverter
JdbcTemplate
WebSecurityConfigurerAdapter
:
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated().and()
.requiresChannel().and()
.oauth2Login();
}
}
Your database is expected to have the following schema:
|---------------------------STOREACCESSTOKENS-------------------------------|
| |
|id--storeDomain--tokenType--tokenValue--salt--issuedAt--expiresAt--scopes--|
| |
|---------------------------------------------------------------------------|
Make sure you use HTTPS to comply with Shopify’s security requirements.
Make sure your app is running and is live at the hostname you specified.
The following endpoints were registered:
/install/shopify?shop={your-store-name.myshopify.com}
:
shop
parameter will force a redirect/init
:
shop
parameter/login/app/oauth2/code/**
:
/info
:
/logout
:
Coming soon!