Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for subdomain #201

Open
pulse97 opened this issue Dec 31, 2015 · 5 comments
Open

Support for subdomain #201

pulse97 opened this issue Dec 31, 2015 · 5 comments

Comments

@pulse97
Copy link

pulse97 commented Dec 31, 2015

I is there anything which will help to make work with support of sub domains

Ex company1.mysite.com
company2.mysite.com

all will use to authentication with simple authentication. Please have a look it will be big help to me!

Thanks

@PureKrome
Copy link
Member

Hi @pulse97 - Happy New year mate.

Ok - I have no idea what you are saying 😞 This library works with any domain. At work, we use this with http://purekrome.mywebsite.com and http://anotherDeveloper.mywebsite.com (subdomains) without any problems.

The fact that it's www or <subdomain> is irrelevant. You're still going off to another provider (eg. Google, Facebook, etc) to authenticate and you are redirected BACK to your main website.

Maybe you can give us some details about what is the problem you are facing?

@pulse97
Copy link
Author

pulse97 commented Dec 31, 2015

Hi,
Happy new year....
Thanks for reply, basically my scenario is that i try to integrate with https://integrate.37signals.com

And i have a application with support sub domain like company1.mysite.com, company2.mysite.com etc.

redirect_uri at 37signals integration is mysite.com. so how can i manage and pass redirect_uri without subdomain bcz it takes URL as request_uri in code.

Please advice me i how i proceed in this type of scenario

@PureKrome
Copy link
Member

Ok - gotcha.

This issue has nothing to do with SimpleAuthentication but it a general concern for OAuth 2.0.

Depending on the OAuth provider (eg. Google, Facebook or 37 Signals) the redirect url might be required to exactly match the value you send to the provider, for the process to work.

Ok - so what does that mean?

When you create an OAuth API Key with your Provider, you usually have to also provide the return_url value. This is the url which the provider will send the user back to, once the user has provided their password.

This value is UNIQUE. This means, you say : return back to www.mysite.com/oauthReturn. Notice how it's hardcoded to www. this means u can't do other subdomains.

So how do you do subdomains then?

EASY :)

you need to create 1x API KEY per subdomain.

So if you have company1.mysite.com, the log into 37signals and create an apikey thingy for that subdomain. Now, for company2.....com .. create another apikey with 37 signals. Rinse, repeat.

If you have 10000000 subdomains, then you're in trouble.

Now, some providers don't care what value you have for the return url. SimpleAuthentication also sends the return url to the provider so if 37 signals doesn't care .. then you only need to create 1 api key. Providers like Google - they are very strict. if the return url SimpleAuthentication sends across to Google doesn't exactly match the value in the API key setup (under console.developers.google.com) then the oauth stuff fails with an ugly error message.

So there you have it.

Depending on your provider, you might need to create 1x API key per subdomain.

Give it a try and report back here, plz.

@pulse97
Copy link
Author

pulse97 commented Jan 1, 2016

Hi, i got your point of view. But need help on below

https://github.com/SimpleAuthentication/SimpleAuthentication/wiki/Getting-Started-::-Simple-Mvc-Example

can you give me complete demo on it, because i am newbie in MVC C# not able to get it work in my App.

@PureKrome
Copy link
Member

The demo's are found here: https://github.com/SimpleAuthentication/SimpleAuthentication/tree/dev/Samples

If you need instructions about how to get an API Key from 37 signals, then you'll need to figure that out yourself. That's out of scope of this (or any) library.

EDIT: Our wiki also has some information about how to start: https://github.com/SimpleAuthentication/SimpleAuthentication/wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants