Scheme url to open ios aplication with parameters - swift

I have an application in Swift which has the function of "I forgot my password", which sends a URL in the user's email, in that URL contains user and token
Example:
https://example.com/forgotPassword#/user/token
Clicking the "https://example.com/forgotPassword#/user/token" link requires the application to open when the link is clicked by passing the parameters after the # (user / token) as follows in the example.
I need to click on the link and open the application.
I tried to modify the info p list in xcode but it generates a link example: application: //, me limiting to send it by email for example, could anyone help me please? If you have not understood, I can explain it better, thank you in advance

The problem is that you are using the word "scheme" in your question title but your example doesn't use a scheme. Well, it does use a scheme, but the scheme is https, which is a link. You need your app to define and declare its own scheme.

Related

cant understand how to use url-scheme

I made authorization with instagram in safari then opens my redirect-URL: “https://badyi.github.io + code “.
I need to grab redirect-URL. What is url-scheme here?
What is identifier?
What i have to put in info: URL-types?
I know about canOpenUrl method, but idk what to put in info
For example:
bundleID: 999
clientID: G0G
Secret: 666W
redirect_URL : https://badyi.github.io
Upd:
I use oauth2 to use instagram profile data in my ios app.
what I got:
1) the application opens
2) by clicking on the button, opening the safari with the authorization page
3) after logging in, redirect_url opens in safari
I expect that after 3 steps I will be transferred to my application and I will be able to handle my redirect url
Your redirect url has scheme https. It means open "in web", that's why it was handled by Safari
If you want to return to your app after auth, you need to implement your own scheme
Please check documentation about this feature
Option 1: Deeplinks
As #viktor mentioned, you need to implement your own scheme in your application, and set redirect_URL to it.
For example, if you have application named "FooBar", you can make scheme foobar, so the redirect_url can be something like:
foobar://returnFromRedirect?maybeArg=some, then, you need to parse this URL in your application and proceed it properly. Here an article about it
Option 2: Universal Links
You can add trusted domain to your application, so all links from this domain can be opened with your application. Apple documentation

How to redirect from Yahoo to my IOS app after authentication?

I am working on an app where I have to use Yahoo account to login.
I had gone through this link and followed the procedure as it was there.But I am unable to get back to my app after authentication.After googling I found an answer here.Here he said that "Add an URL Scheme in your info.plist file with the YOUR_APP_ID_OR_BUNDLE_ID" I did the same,but unable to redirect from yahoo to my app.If any one worked on this please help me.Thanks in advance.
This is what I had done in my URL Schemes
where JCzOzd44 is my app ID.
In yahoo account while creating the app.what should I give in "Application Domain"
I didn't work with the Yahoo! API yet, but in oauth it works like that:
Create an url scheme in your app. You can do that in the Info section of your project settings (URL types). Name the scheme whatever you want, for example your app id.
When you authenticate your app, you can pass a parameter named oauth_callback. Here you have to pass the name of the just created url scheme.
This should be it - when the login is ok on the Yahoo side, it will try to open the app that is registered for the url scheme it got as callback parameter.
UPDATE:
From the Yahoo! API documentation - this is the call you do when requesting the oauth token somewhere in your code (I filled in your url scheme as the callback, this is how it should look like):
https://api.login.yahoo.com/oauth/v2/
get_request_token?oauth_nonce=ce2130523f788f313f76314ed3965ea6
&oauth_timestamp=1202956957
&oauth_consumer_key=123456891011121314151617181920
&oauth_signature_method=plaintext
&oauth_signature=abcdef
&oauth_version=1.0
&xoauth_lang_pref="en-us"
&oauth_callback="JCzOzd44://"
Of course the request should be signed.
I have found the solution though with a little overheads.
Steps are: 1> Create a PHP script in you own server (say named, YRedirect.php).
2> Paste the following code in it-
CODE
<?php
$query = $_SERVER['QUERY_STRING'];
header("Location: com-mycompany-myapp://oauth-response?" . $query);
>
Where "com-mycompany-myapp" is your bundle identifier
3> Add an URL Scheme in your info.plist file with the YOUR_APP_ID_OR_BUNDLE_ID. That's it and you are DONE with the authentication problem.
In your code
[self.session sendUserToAuthorizationWithCallbackUrl:#"http://yourdomain.com/YRedirect.php"];
Then, register a custom URL scheme for your iPhone application from your Info.plist file, and then setup your server side script to redirect Safari back to your application via the URL scheme you just set up.
Thanks for this valuable information. Following your instructions I got the auth & call back working and the php page loads the app.

Can we modify short link created by google url shortner?

By mistake I have uploaded the application on the App Store without changing the URL for Facebook.
This is the url which is being shared : goo.gl/7wK2
and it redirects to: https://itunes.apple.com/us/app/tap-tap-balloon!/id535053777?mt=8
Can we do something so that the same URL (goo.gl/7wK2) will redirect to: https://itunes.apple.com/us/app/find-a-thing/id638627376?mt=8?
Is this possible via the Google URL shortener API or by any other method?
I think you can not.
You have to create another short url and then republish your application
I think you can not, because the url is derived from what we send to goo * le server.
If you want to change, you must send or submit your new url to goo * le.
You can surely do it using tiny.cc. I have used it and was working fine easily.

Facebook authentication within a Page Tab

According to the specification here: http://developers.facebook.com/docs/authentication/pagetab/ I want to autorize user with the server-side flow on page tab. I use PHP-SDK.
My redirect_uri parameter is build like that:
https://www.facebook.com/pages/null/PAGE_ID/app_YOUR_APP_ID
and I keep getting:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
I was trying many different settings combinations. Now I have filled fields: App Domains,Site URL,Canvas URL,Secure Canvas URL,Page Tab URL,Secure Page Tab URL but still without success. Addresses are ending with / and are all the same.
Link are build proper by the sdk. I test building it "by hand" without encoding of redirect_uri param and redirect link build like that:
https://www.facebook.com/PAGE_USERNAME/app_YOUR_APP_ID
https://www.facebook.com/pages/Page_Title/PAGE_ID?sk=app_YOUR_APP_ID
Can someone tell me what i'm doing wrong?
The answer to that question is that facebook documentation is incorrect. Format of return_uri that worked is:
https://www.facebook.com/pages/null/PAGE_ID?sk=app_YOUR_APP_ID
The format of return_uri changed again, the new format is:
https://www.facebook.com/PAGE_NAME?sk=app_YOUR_APP_ID

recognizing a link in an email

Is there a mechanism where I can identify a string in an email, say a order number, and have it route to my iPhone application? I know that base types do this, but not sure if I can create a new type for my app.
Thanks!
You can add a custom URL type through your app (say orderNum://)
Then, if you include a link in the email, say orderNum://1234567890
if the user clicks it, it will open your app, and you will be able to get the data it sent you.
See the LaunchMe example: https://developer.apple.com/library/archive/samplecode/LaunchMe/Introduction/Intro.html