Swift - Firebase - Authentification email passwordless - ios

I'm trying to put an email/passwordless authentification with Firebase (Swift)
https://firebase.google.com/docs/auth/ios/email-link-auth
In the doc, they mention this setup :
let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.url = URL(string: "https://www.example.com")
// The sign-in operation has to always be completed in the app.
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
actionCodeSettings.setAndroidPackageName("com.example.android",
installIfNotAvailable: false, minimumVersion: "12")
I don't understand what is the URL in
actionCodeSettings.url = URL(string: "https://www.example.com")
What must I put on this URL ?
And the AndroidPackageName is confusing me either. It can be deleted, right ?
Thanks for your help !

Firebase Auth uses Firebase dynamic links (FDL) to pass the email link OTP back to an app. FDL is used for web to mobile redirects. A critical part of the FDL link is the deep link within it (required when constructing an FDL link). If the link is triggered from a device where the target mobile app is installed or a non-mobile device (laptop/desktop, etc), the link is used as a fallback. This link is also useful to pass any additional state back to the landing page. In this case, it will be used as a mechanism to pass the code back to the app or fallback webpage.

Related

Twitter API: How Do I Create a Protocol Only Callback URL?

In Twitter's Developer Documentation we can read the following:
Mobile apps with app-specific protocols must use just the protocol
Example:
You want to use example://authorize as your callback URL
Add this to both your Twitter app dashboard and your call to oauth/request_token: example://
However; in the Developer's Dashboard I am not able to enter a protocol only URL, or any URL beginning with other than http or https.
My reason for wanting a protocol only URL is so that I can use in an iOS app that uses OAuthSwift to access web APIs.
Any ideas anybody?
I haven't found the answer to the original question but I do have an excellent work around. So, for anyone else who might land here:
The web app at https://oauthswift.herokuapp.com/callback
will perform redirections. If you access that web site with the url https://oauthswift.herokuapp.com/callback/target then it will redirect to oauth-swift://oauth-callback/target.
So:
In the Twitter Dashboard enter https://oauthswift.herokuapp.com/callback/SomeName for your app's callback URL
Register oauth-swift as a URL scheme in your iOS app's URL Types
In your iOS app, use https://oauthswift.herokuapp.com/callback/SomeName as the callback URL for the OAuth authorization request.
Voila. Twitter will redirect to https://oauthswift.herokuapp.com/callback/SomeName which will in turn redirect to oauth-swift://oauth-callback/SomeName, allowing your iOS app to regain control of the flow.
If you find any of this confusing then this might help: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

What redirect URL to use when logging in with GitHUB with OAuth2?

I'm new in ios sdk and English. Therefore, sorry for my Eng.
I try to do authentication through github using OAuthSwift.
In the registration of the application (https://github.com/settings/apps), there is need a redirect URL. In the tutorial from raywenderlich.com was an example, they did authorization through Google. They wrote a unique domain in this line that does not work: com.raywenderlich.Incognito. And in Info.plist, we added a Scheme URL with com.raywenderlich.Incognito, so that (as I understood it) when we go to this address after authentication, we’ve got into our application. But if you try to add in the application settings (https://github.com/settings/apps) the Redirect URL: something like com.raywenderlich.Incognito, will generate an error, because github wants the URL to have to be valid. If we put the Valid URL there, then when we will be redirected to this address, we will simply go to it and will not return to the application.
I would be grateful for any help.
Sorry for my English.
Redirect url in OAuth is the url that the authentication provider navigates to when authentication is successful.
For mobile apps it is the link that launches the app (a sort of deep linking)
For websites it is the website home screen

iOS - GitHub Firebase Authentication

I'm currently trying to implement GitHub Authentication via Firebase in an iOS app.
I've read through the docs and figured out what I have to do. I'm having trouble though, in implementing the communication between my app and the WebView where I authorize the application to get user's data. I currently have this code:
let url = urlComponents.url! // https://github.com/login/oauth/authorize + scope
// Not quite sure if I should use open(_:options:completionHandler:) to handle this operation.
guard UIApplication.shared.canOpenURL(url) else {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
What this code does is bring the user to the browser with the GitHub authorization screen, type the password and then a blank screen shows up. Inspecting the URL in this blank screen, I've found out that it contains the parameter it should have, but I'm not quite sure how to pass this parameter to my code so I can proceed with the authentication.
Firebase doc says I should implement a Custom URL scheme to handle the OAuth callback, but I'm not sure how to do it.
Solved, solution was to edit GitHub's Authorization callback URL to have my custom URL scheme and then proceed through the documentation flow.

PayPal iOS Live App Settings - What is return url?

I would like to know what this is for (return url)? Is this some kind of deep linking to my app? I don't have any deep links to my app. I've been doing sandboxed paypal transactions in my iOS app, the user is just notified by a modal screen and then redirected to the home page of the iOS app.
Any tutorial about this or step to step guide for this? I need to go live today and I couldn't find a guide for this. thanks.
There are multiple "return urls" for PayPal, it could be for the link the user is redirected to after a purchase (which the hint seems to indicate), or in this case for the "Log In with PayPal" feature (which the "Oauth return url is invalid" seems to indicate).
Quoting the this doc:
You must specify all return URLs for an application in the Developer Dashboard before you can use that return URL in an application. For example, if you develop a REST application and you configure Log In with PayPal (LIPP), you must configure the return URL for the application in the Developer Dashboard for it to work in you LIPP configuration.
A starting point for more information on LIPP is: https://developer.paypal.com/docs/integration/direct/identity/
Or, if you're looking for information on a specific API call:
https://developer.paypal.com/docs/api/identity/#tokenservice_createFromAuthorizationCode ... quoting that:
Application return URL where the authorization code is sent. The specified redirect_uri must match the return URL registered for your app on the My Apps & Credentials page of the PayPal Developer site.

How to let user sign in through a browser

I use OctoKit library to access API of github , but how can I implement a custom URL scheme in iOS (I don't know how to let user sign in through a browser )?
This document describes how to implement custom URL schemes.

Resources