{ "read_content" };
+ BackchannelTimeout = TimeSpan.FromSeconds(60);
+ Endpoints = new ShopifyAuthenticationEndpoints
+ {
+ AuthorizationEndpoint = DefaultAuthorizationEndPoint,
+ TokenEndpoint = DefaultTokenEndpoint,
+ ShopInfoEndpoint = DefaultShopInfoEndpoint
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs b/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
index 38f622f..e2ffd42 100755
--- a/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
+++ b/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
@@ -30,6 +30,7 @@ using Owin.Security.Providers.SoundCloud;
using Owin.Security.Providers.Spotify;
using Owin.Security.Providers.StackExchange;
using Owin.Security.Providers.Steam;
+using Owin.Security.Providers.Shopify;
using Owin.Security.Providers.TripIt;
using Owin.Security.Providers.Twitch;
using Owin.Security.Providers.Untappd;
@@ -53,7 +54,7 @@ namespace OwinOAuthProvidersDemo
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
- //app.UseDeviantArtAuthentication("id", "secret");
+ //app.UseDeviantArtAuthentication("id", "secret");
//app.UseUntappdAuthentication("id", "secret");
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
@@ -185,6 +186,8 @@ namespace OwinOAuthProvidersDemo
//};
//app.UseSalesforceAuthentication(salesforceOptions);
+ ////app.UseShopifyAuthentication("", "");
+
//app.UseArcGISOnlineAuthentication(
// clientId: "",
// clientSecret: "");
@@ -201,7 +204,6 @@ namespace OwinOAuthProvidersDemo
// clientId: "",
// clientSecret: "");
-
//app.UseBattleNetAuthentication(new BattleNetAuthenticationOptions
//{
// ClientId = "",
diff --git a/OwinOAuthProvidersDemo/Controllers/AccountController.cs b/OwinOAuthProvidersDemo/Controllers/AccountController.cs
index 4e544a9..5813dca 100644
--- a/OwinOAuthProvidersDemo/Controllers/AccountController.cs
+++ b/OwinOAuthProvidersDemo/Controllers/AccountController.cs
@@ -182,15 +182,26 @@ namespace OwinOAuthProvidersDemo.Controllers
return View(model);
}
+ //////
+ ////// POST: /Account/ExternalLogin
+ ////[HttpPost]
+ ////[AllowAnonymous]
+ ////[ValidateAntiForgeryToken]
+ ////public ActionResult ExternalLogin(string provider, string returnUrl)
+ ////{
+ //// // Request a redirect to the external login provider
+ //// return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
+ ////}
+
//
// POST: /Account/ExternalLogin
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
- public ActionResult ExternalLogin(string provider, string returnUrl)
+ public ActionResult ExternalLogin(string provider, string returnUrl, string shopName = "")
{
// Request a redirect to the external login provider
- return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
+ return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }), null, shopName);
}
//
@@ -224,10 +235,10 @@ namespace OwinOAuthProvidersDemo.Controllers
// POST: /Account/LinkLogin
[HttpPost]
[ValidateAntiForgeryToken]
- public ActionResult LinkLogin(string provider)
+ public ActionResult LinkLogin(string provider, string shopName)
{
// Request a redirect to the external login provider to link a login for the current user
- return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
+ return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId(), shopName);
}
//
@@ -324,6 +335,8 @@ namespace OwinOAuthProvidersDemo.Controllers
#region Helpers
// Used for XSRF protection when adding external logins
private const string XsrfKey = "XsrfId";
+ // Used for Shopify external login to provide shopname while building endpoints.
+ private const string ShopNameKey = "ShopName";
private IAuthenticationManager AuthenticationManager
{
@@ -380,28 +393,36 @@ namespace OwinOAuthProvidersDemo.Controllers
private class ChallengeResult : HttpUnauthorizedResult
{
- public ChallengeResult(string provider, string redirectUri) : this(provider, redirectUri, null)
+ public ChallengeResult(string provider, string redirectUri) : this(provider, redirectUri, null, null)
{
}
- public ChallengeResult(string provider, string redirectUri, string userId)
+ public ChallengeResult(string provider, string redirectUri, string userId, string shopName)
{
LoginProvider = provider;
RedirectUri = redirectUri;
UserId = userId;
+ ShopName = shopName;
}
public string LoginProvider { get; set; }
public string RedirectUri { get; set; }
public string UserId { get; set; }
+ public string ShopName { get; set; }
public override void ExecuteResult(ControllerContext context)
{
var properties = new AuthenticationProperties() { RedirectUri = RedirectUri };
if (UserId != null)
{
- properties.Dictionary[XsrfKey] = UserId;
+ properties.Dictionary[XsrfKey] = this.UserId;
}
+
+ if (!string.IsNullOrWhiteSpace(this.ShopName))
+ {
+ properties.Dictionary[ShopNameKey] = this.ShopName;
+ }
+
context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
}
}
diff --git a/OwinOAuthProvidersDemo/Views/Account/_ExternalLoginsListPartial.cshtml b/OwinOAuthProvidersDemo/Views/Account/_ExternalLoginsListPartial.cshtml
index fb306c4..47cf847 100644
--- a/OwinOAuthProvidersDemo/Views/Account/_ExternalLoginsListPartial.cshtml
+++ b/OwinOAuthProvidersDemo/Views/Account/_ExternalLoginsListPartial.cshtml
@@ -24,6 +24,10 @@
@foreach (AuthenticationDescription p in loginProviders)
{
+ if (p.AuthenticationType.Equals("Shopify"))
+ {
+ @Html.TextBox("shopName")
+ }
}
diff --git a/README.md b/README.md
index 83ce2da..d657717 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ Provides a set of extra authentication providers for OWIN ([Project Katana](http
- PayPal
- Reddit
- Salesforce
+ - Shopify
- Slack
- SoundCloud
- Spotify
@@ -41,7 +42,7 @@ Provides a set of extra authentication providers for OWIN ([Project Katana](http
- Wargaming
## Implementation Guides
-For guides on how to implement these providers, please visit my blog, [Be a Big Rockstar](http://www.beabigrockstar.com).
+For above listed provider implementation guide, visit Jerrie Pelser's blog - [Be a Big Rockstar](http://www.beabigrockstar.com)
## Installation
To use these providers you will need to install the ```Owin.Security.Providers``` NuGet package.
@@ -71,6 +72,7 @@ A big thanks goes out to all these contributors without whom this would not have
* Anthony Ruffino (https://github.com/AnthonyRuffino)
* Tommy Parnell (https://github.com/tparnell8)
* Maxime Roussin-Bélanger (https://github.com/Lorac)
+* Jaspalsinh Chauhan (https://github.com/jsinh)
For most accurate and up to date list of contributors please see https://github.com/RockstarLabs/OwinOAuthProviders/graphs/contributors
diff --git a/license.txt b/license.txt
index 4d7326e..c11822f 100644
--- a/license.txt
+++ b/license.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2014 Jerrie Pelser
+Copyright (c) 2014, 2015 Jerrie Pelser
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal