I am creating an application integrating with Shopify API that uses OAuth2 for authentication and authorization. Using a tutorial for Spring Security OAuth2 and a tutorial for Shopify , I was able to integrate work with one store. The configuration of YAML is as follows:
shopify:
shop: myshop
scopes: read_customers,read_orders
security:
oauth2:
client:
clientId: myclientid
clientSecret: mysecret
tokenName: access_token
authenticationScheme: query
clientAuthenticationScheme: form
accessTokenUri: https://${shopify.shop}.myshopify.com/admin/oauth/access_token
userAuthorizationUri: https://${shopify.shop}.myshopify.com/admin/oauth/authorize?scope=${shopify.scopes}&grant_options[]=
pre-established-redirect-uri: https://myapp/login
registered-redirect-uri: https://myapp/login
use-current-uri: false
resource:
userInfoUri: https://${shopify.shop}.myshopify.com/admin/shop.json
However, this static configuration will not work for an application published to the Shopify App Store because the redirection, access, user information, and user URIs are dependent on the store name. There are examples of using multiple providers , but they should still be static.
URI , :
/login , , ThreadLocal, , AuthorizationCodeResourceDetails, OAuth2 Spring factory bean.
"", OAuth2ClientAuthenticationProcessingFilter , .
OAuth2ClientAuthenticationProcessingFilter, RestTemplate, .
. URI Spring Security OAuth2?
, OAuth2 , Spring ?