How can I check domains (and subdomains) entered by users vs my whitelist? - swift

I'm looking for a SWIFT solution / function that will check if the entered url by a user is allowed by our system. (White listed).
It should also check for certain or any subdomains that domain might use as well.
for example, if I whitelist google.com, the following urls would return true.
google.com/xxxx
mail.google.com/xxxxxx
[any].google.com/xxxxxx
Any help please?

You can use regex to find out the subdomain.
/(http:\/\/)?(([^.]+)\.)?google\.com/

Related

Google Search Console Add Domain and/or Site URL?

If I have added a property as https://example.com, and then decide I would rather add the whole domain using TXT, should I then remove the url-based property please?
It's not really needed !
Personnaly I kept both of them !
Like that, you can see more details datas : In the url-based you see only the subdomain concerned; and with the domain using TXT you see the all domain.
Sometime could be usefull to have also an or some subdomnains + the global..

Google GTMAppAuth Redirect URL

I am using the Google GTMAppAuth with my swift project for authorisation. The thing is, I don't know what to put as a Rediret URL. I couldn't find anything on stack or anywhere else about what it is supposed to be. I am new to the google api so help would be appreciated.
After Successful creation of oauth2 credentials (https://console.developers.google.com/projectselector/apis/credentials) you will get client ID for your project.
Follow the below instructions...
kRedirectURI is reverse DNS notation form of the client ID. For example, if the client ID is YOUR_CLIENT.apps.googleusercontent.com, the reverse DNS notation would be com.googleusercontent.apps.YOUR_CLIENT. A path component is added resulting in com.googleusercontent.apps.YOUR_CLIENT:/oauthredirect.
Finally, open Info.plist and fully expand "URL types" (a.k.a. "CFBundleURLTypes") and replace com.googleusercontent.apps.YOUR_CLIENT with the reverse DNS notation form of your client id (not including the :/oauthredirect path component).
Once you have made those three changes, the sample should be ready to try with your new OAuth client.

Links have random characters prepended in email

I am using the current link in my email.
*|baseUrl|*/verifyEmail?token=*|token|*
This however causes one or two people to get strange links from the email and get not found, usually based on some random email providers. E.g. - if I use a 10 minute mail (10minutemail.com), I get the following:
https://10minutemail.com/10MinuteMail/www.mywebsite.com/verifyEmail?token=b32fee82da59e7b4085269faca35ec7025122876
Correct link: www.mywebsite.com/verifyEmail?token=b32fee82da59e7b4085269faca35ec7025122876
Assuming this is due to baseUrl? Am I doing something fundamentally wrong when setting up my email link?
You need to include http:// or https:// with your baseUrl. Otherwise the email client may prepend a default base address instead of 'just' the missing protocol, especially if it is a webmail client.

List of Facebook CDN addresses

I need to compile a list of the addresses of all the CDNs used by Facebook.
Example:
fbcdn-sphotos-a.akamaihd.net
fbstatic-a.akamaihd.net
...
I need these for a captive portal application that allows user to connect to WiFi with facebook. We allow facebook.com through the firewall for Graph API calls, but one of the issues we had is that the Facebook login dialog takes forever to load and loads without stylesheets/images. We fixed that by white-listing fbstatic-a.akamaihd.net, but we want to make sure we won't have surprises later.
fbstatic-a.akamaihd.net
fbcdn-profile-a.akamaihd.net
fbcdn-sphotos-a-a.akamaihd.net
fbcdn-creative-a.akamaihd.net
fbexternal-a.akamaihd.net
And:
fbcdn-sphotos-b-a.akamaihd.net
fbcdn-sphotos-c-a.akamaihd.net
fbcdn-sphotos-d-a.akamaihd.net
fbcdn-sphotos-e-a.akamaihd.net
fbcdn-sphotos-f-a.akamaihd.net
fbcdn-sphotos-g-a.akamaihd.net
fbcdn-sphotos-h-a.akamaihd.net
Those start from character A and ends at H, if Facebook would add a new domain it must be like :
fbcdn-sphotos-i-a.akamaihd.net
So future CDN domains would be
fbcdn-sphotos-j-a.akamaihd.net
fbcdn-sphotos-k-a.akamaihd.net
fbcdn-sphotos-l-a.akamaihd.net
fbcdn-sphotos-m-a.akamaihd.net
fbcdn-sphotos-n-a.akamaihd.net
And So on.. till character Z
akamaihd is used for old photos and for special photos(cover ph. example..) only as I see...
They created new servers and there is some new logic in them as well. Example:
scontent-a-lhr.xx.fbcdn.net
scontent-b-lhr.xx.fbcdn.net and more but I have seen some shared photos on interesting links. Example this:
https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/v/1472407_10151814939401656_1687041676_n.jpg?oh=d92bc9af7f987c5fe298ecc8c717a4e1&oe=5287894B&__gda__=1384659513_abeb3f33223e6e737aff91419149509e

"Website: Not a valid URL format" when creating an application of twitter

I'd like to create an application that can integrate with Twitter.
So I went to the website: https://dev.twitter.com/apps/new to create an application.
But the WebSite: field always failed. It said that "Website: Not a valid URL format".
I tried different "valid" URLs, but failed.
Do you have any ideas on the twitter application?
Thanks in advance.
Michael
I was trying to set localhost URL and got the same error message.
After replacing
http://localhost
http://localhost/twitter/callback
with
http://127.0.0.1
http://127.0.0.1/twitter/callback
it let me saved my test application
Mine is working. Save it in this format http://url.com. Even this domain.com works.
You can try doing it in a different browser, logout and login.
In my case the problem was in trailing whitespace from copy/paste.
One easy mistake to make is both the callback url and website need to start with http://
This worked for me:
WebSite: http://example.com
CallbackURL: http://example.com/auth/twitter/callback/
I'm able to make applications if I include "http://" at the beginning. Also it might be something browser related (I'm using Chrome) so check that.
I was having the same Issue, then after googling, someone said that:
"I think your website and callback should match. Some examples:
website: http://www.quoteicon.com
callback: http://www.quoteicon.com/twitter/callback "
summarizing the field callback has to be prefixed with the website, otherwise it gets error that the URL is invalid!
and they dont accept local IPs to the webSite fields.
It worked for me, hope this help you.
Old question but I ran into this today. Twitter does not allow localhost or IP addresses in the URL (plus it does require http:// or https:// as a prefix).
However this doesn't help with local debugging.
So an easy workaround is to add something like myapp.here.com in your /etc/hosts file
127.0.0.1 myapp.here.com
and then enter http://myapp.here.com and http://myapp.here.com/auth/twitter in the fields.
That should allow local debugging. It is odd as Facebook makes this a bit easier and it seems like a common task for debugging these types of integrations.
You could even override your actual domain locally if you wanted to use the same Twitter App ID.
Be aware of localhost, if you are developing on local machine. Twitter doesn't allow url with http://localhost:3000 or without http.
I'm wonder, why ;] Hope, They will add it.
I just found that I didn't have a problem with my callback url at all, but the error message was for the Website url!
Tried everything now, eventually only https://example.com/auth worked.
I simply added www and the error was gone.
Previously
http://twitter.com/...
After
http://www.twitter.com/...
This issue is resolved when I give my Website & Callback URL same htt://URL.Hope it will help to resolve your solution.