Url scheme in Facebook feed dialog - objective-c

So I finally got a link in my facebook post using the properties parameters. I thought I could put my url scheme in there. But unfortunately it says it isn't a valid url, which makes sense. So I searched again for another solution. But everyone seems to be talking about fb:// and not their own app url scheme.
So I created this thread, hope somebody can help me.

Try using bit.ly (or some other URL shortener).
The last time I tried, bit.ly accepted any URI schema and just did a redirect. I've successfully used this in the past to work around inputs that expected either an HTTP or HTTPS schema.
Additionally, similar logic could be done on your own server if you prefer. Simply share a link to your own server on Facebook, and have your server side script do a 301 to whatever App specific URI you have.

Related

Vue + Flask Gmail API

I am attempting to build a webapp using Vue for the frontend and Flask for the backend that reads in the users Gmail emails.
Desired functionality:
User clicks a button to "Link Gmail Account" on the frontend
User is authenticated with gmail Oauth2 and confirms. Once confirmed, they redirect back to the page they were on
Once the user confirms, the backend queries gmail to get all of the users emails and returns the data to the frontend
I have been trying to use https://developers.google.com/gmail/api/quickstart/python as a starting point, but I cannot authenticate the user -- I keep getting a redirect uri mistmatch error with a random port (I am doing this locally so have set the redirect uri to be the localhost port where I access my project).
I think I am doing something fundamentally wrong or not using the Gmail API in the correct way, but have searched all over google and youtube to no avail.
Specific things that I think could be causing an issue:
What is the best overall strategy to implement this? Should I use the Gmail API in Python or Javascript? Right now, the use clicks the "Link Account" button which calls an API in my backend which then runs the code in the Python Quickstart guide.
What kind of google project should I set up? I currently have my credentials configured for a "web application"
What should I put as the redirect uri? I am using localhost but am unsure exactly what to put here (I have tried http://localhost, http://localhost:5000, http://localhost:5000/, http://localhost:5000/emails [this is the url I want them to return to]). No matter what I put, I keep getting a redirect uri mismatch and it says the uri it is looking for is http://localhost:[random port]/
I would appreciate any help on how to approach achieving this. Thank you!
Depending on what you are going to use Gmail API for, you must select the device or category. In your case, as it is a website it should be set to "Web Application".
Also, you should be using the following redirect URI: http://localhost/emails/. You should not include the port number and you should be using trailing slashes (adding the last / at the end). Note that the redirect URI you set up in your backend must be an exact match of the one you have set up in your Credentials Page. Also please note that it might take some minutes to update this URI.
Moreover, this is a guide on how to create a Sign In button that will authorise your users that I believe will be useful for you.

AWS Cognito built-in UI error posting credentials when using response_type=code

I have spent a significant amount of time searching for a solution here and can't find one. Here is the situation:
I am using the built-in Cognito UI
When I redirect my app to the UI with response_type=code, I get to the login page fine. When I enter my credentials and click "Sign In" the post request to the /login cognito endpoint results in a 405 method not allowed
If I instead redirect my app with response_type=token, it redirects to my return_url with no problem, but the parameters are harder to retrieve as they are hash parameters instead of query parameters.
I am actually a little surprised either one works because the documentation seems to indicate the /login endpoint is GET only: https://docs.aws.amazon.com/cognito/latest/developerguide/login-endpoint.html
I'd prefer to use the code response_type anyway. Am I doing something wrong here? Is anyone else having this issue? I don't think I'm doing anything unusual. It feels to me like something is just broken in the built-in ui flow. I have definitely discovered that I should not be using the built-in UI, but I'd like to get this working and then replace it if possible.
Please let me know if you need more information and I'd be happy to provide it.
EDIT: It actually does work if I make the redirect_url google.com, which means it's something with my app and the redirect, but there is basically no indication about what is wrong. Anyone know where I can find any kind of relevant logs or information related to these types of errors in Cognito?
Alright this appears to be a bug in the built-in UI and I'll file it with Amazon. I finally figured out that my redirect_uri I was sending over had a trailing slash and the one I configured in Cognito did not have a trailing slash. It works when I remove this.
The reason I believe this is a bug is because normally when I pass in an invalid redirect, the UI immediately sends me to a page with that error. When the only difference is a trailing slash, I can go through the login flow fine, but it hits that 405 method not allowed error when trying to redirect back to my flow.
Not sure if anyone else will run into this very odd edge-case, but hopefully this is helpful if you do.

Pinterest redirect_uri query parameter

In my Pinterest app I have set the Redirect URI to https://my.site.com/pinterest/callback. When doing the redirection after authentication back to my site I append a sessionid so the query becomes https://my.site.com/pinterest/callback?sessionid=<string>. This doesn't seem to work as I get
The provided redirect_uri https://my.site.com/pinterest/callback?sessionId=YA6udv2FrdjjV8juij3U5oIBBP6RoEQWWUFNzSHKaHGGf3jRq10uJ2A0-R-eYB8LLwiBTbESEdGzMY0fhYI8d7gOe3kOoPuPS6c-mowaaJBDv0J8D2I does not match any of the registered redirect URIs."
In other apis like the Instagram one this is possible. Can anyone help with this? Thanks a bunch!
I have been stucking with this for two days. Basically, Pinterest doesn't support custom parameters like other websites do, for Pinterest you need to provide the EXACT callback url and it has to use https not http, and if you need to pass custom parameters they should be in state parameter.
From Pinterest docs
state: A value you define. This can be used to make sure that the redirect back to your site or app wasn’t spoofed.
See Authentication section at https://developers.pinterest.com/docs/api/overview/

Is it ok to use http dropbox file links instead of https?

Using dropbox '/media' API call I've obtained a direct https file link. Something like this:
https://dl.dropboxusercontent.com/1/view/asdfasdfasdfasd/file.ext
Then I've changed it from 'https' to 'http' and successfully downloaded the file. Obviously enough, the modified link looked like this:
http://dl.dropboxusercontent.com/1/view/asdfasdfasdfasd/file.ext
My question is wether it's ok to use http links or not? Is it some sort of dropbox bug or a hack?
Strange. I get a 400 error when I try to do the same thing.
Even if HTTP is working for you, I'd advise against using it. Someone eavesdropping on your traffic could learn the link to the file, and it's also possible for someone to impersonate dropboxusercontent.com and send you the wrong data.
It's probably best to stick with HTTPS.

Magento Rest API Oauth URL Returning 404

From the Magento wiki at:
http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html#OAuthAuthentication-OAuthProcess
When getting an API token you start off by getting an Unauthorized Request Token at:
www.mystore.com/oauth/initiate
However, my code does not work and when I browse to the above url in my browser I get a 404.
I am appending shop store code to the base url (eg www.mystore.com/en/) I don't know if this alters anything.
The Magento Wiki has a typo:
$adminAuthorizationUrl = 'http://yourhost/admin/oAuth_authorize';
Should be:
$adminAuthorizationUrl = 'http://yourhost/admin/oauth_authorize';
I struggled with this one for most of the day, so here's a late contribution in case it helps anybody:
The authorization URL that's documented by Magento, admin/oauth_authorize, assumes that you're not using a custom URL for your admin access. "admin" is the standard URL to access the Magento dashboard, but many people change it for security. If you have changed your admin URL to something other than "admin", use that instead.
IOW if you access your Magento dashboard at https://yoursite.com/foo, then your authorization URL is foo/oauth_authorize.
I also had the problem, that the following request returned the 404 http status:
http://yourmagentostore.com/oauth/initiate
The solution was quite simple: In case if you are using multiple stores and/or store views on the same domain, don't forget to add the url path which maps to the store view. E.g.
http://yourmagentostore.com/<my-store-view-path>/oauth/initiate
I just had the same problem. Not many similar problems to be found and no solution. This is strange because this seems to be a missing config option 'global/request/direct_front_name', which isn't set in Core/Oauth module. How can all the tutorials work without this important setting!?
Without "oauth" setting being there, every call to /oauth/[controller] leads to "noRouteAction" being resolved (see. Mage_Core_Controller_Request_Http::setPathInfo() and Mage_Core_Controller_Request_Http::isDirectAccessFrontendName($storeCode)) instead of default indexAction.
So, the solution is to set this setting in local config or an own extension as follows
<?xml version="1.0"?>
<config>
[...]
<global>
[...]
<request>
[...]
<direct_front_name>
<oauth/>
</direct_front_name>
</request>
</global>
</config>
Afterwards you can finally get the token at least. I'm checking the further process now.
There is one subtlety don't forget the http:// so your call to the store should be
http://yourmagentostore.com/oauth/initiate
Also there is more to REST services setup then on the link you posted, it is only an overview. There is a ton of configuration on the store before you will actually get a rest response and when the user isn't recognized, unauthorized or without proper ACL privileges you will get 404 or 500 responses. I guess that deters hackers but it is a bear to trouble shoot. I've been down this road and although I am using an automation tool the Setup of the store and troubleshooting is the same.
Take a look on my blog I keep it up to date with my adventures with the Magento REST API
Cheers!
Rich Borek
http://magento-simplified.blogspot.com