nativescript-urlhandler plugin: what is the desired scheme? - plugins

I'm writing an app with NativeScript v 6 and Angular v 8.
I want to use this plugin: https://www.npmjs.com/package/nativescript-urlhandler
I'm using it for some SSO authentication.
It says in the documentation in the AndroidManifest file that we must set our desired scheme:
What is this scheme and how do I know what is my desired scheme?

The desired scheme is something of your own choice. In the example they use myapp, you may replace it with your app name. This is the name your Authenticator will use to open your app when the authentication is done. You may compare this to a redirect url you will use on web apps.

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

Symfony2.8 API + Login Form

I have a website that uses Symfony2.8; I am working on a mobile app that would use the same project as the backend so I need to support token based authentication as well as regular login forms. All resources I've found talk about API only authentication not API(token based) and form. Anyone has any ideas how to accomplish this?
I am using FOSUserBundle if that matters.
You can do it by using custom Authenticators for each case.
Symfony 2.8 introduced Guard, which makes it's relatively easy to create custom Authenticators.
Basically you create 2 custom Authenticators , which essentially means creating 2 Services.
FormLoginAuthenticator -> app.form_login_authenticator
ApiTokenAuthenticator -> app.api_token_authenticator
Once these services are created, you just have to register those as Authenticators
in app/config/security.yml
security:
...
main:
anonymous: ~
knpu_guard:
authenticators:
- app.form_login_authenticator
- app.api_token_authenticator
entry_point: app.form_login_authenticator
Obviously it's upto you to implement those Services, but Symfony Docs does provide a decent starting point for you to start .
Check these links for the same :
How to Create a Custom Authentication System with Guard
How to Use Multiple Guard Authenticators
https://knpuniversity.com/screencast/guard ( provides fully working example + tutorial )

How can I get the url and / or port number of a sails app before it lifts in /config?

I'm building a Sails app. In it, I'm using passport-azure-ad. When setting up passport, I need to tell it where to send the user after they sign in (for example: http://localhost:1337/login/callback), which means I need to tell it the url of the current sails app. But sometimes, the app is on localhost:1337, sometimes it's on localhost:81, sometimes it's on localhost:3000, or if I'm using browser-sync, it's on 10.18.152.135:3000, and in production, it's on https://www.<my-domain>.com.
This passport strategy doesn't allow relative urls either. I need to send it the full absolute callback url.
Use environment-based config files to hard-code different domain URLs

Hello.js Demo Twitter Error

hellojs twitter error
When i run the twitter demo from demo folder and clicked on twitter button it give me following error
url is undefind in hello.js file on this line if(url.indexOf(x)>-1){
how to fix this error
thanks
When running the demo page in question
http://adodson.com/hello.js/demos/twitter.html
You'll see...
hello.init({
'twitter' : TWITTER_CLIENT_ID
},
{
redirect_uri:'../redirect.html',
oauth_proxy: OAUTH_PROXY_URL
});
The setup includes an OAUTH_PROXY_URL variable. This tells HelloJS the location of the server-side shim in order for this to work with OAuth1 authorisation providers like Twitter (unlike OAuth2 providers which can share authentication tokens purely client-side)
If running this from a local domain like //localhost this will have been an undefined value.
You'll need to do two things to get the demo working.
Define the oauth_proxy option in the demo code. See http://auth-server.herokuapps.com for setting one up. OR remove it entirely and by default it will use the above service - you'll need to register third party apps there (recommended).
Change your development environment in your host file to something other than //localhost, that way you can register OAuth2 providers which are domain sensitive and often wont let you use localhost when registering your apps callback URI. If you change your development environment to be local.knarly.com with hello.js project as a subfolder - then you can skip step 1 as the oauth_proxy will be defined correctly.

phonegap crossplatform redirection to local file

Hi I'm developing a phonegap + JQueryMobile app, which should be correctly executed on Android, iOs and WindowsPhone as well.
I need to exploit an external service which requires one callback URL to redirect the app to in case of success, and one in case of error (pretty common situation. In my case both will be local files, say www/success.html and www/error.html). Of course I could write different paths for each device (e.g. file:///android_asset/www/success.html on Android), but I'm wondering if the framework provides a more elegant and solution.
So the questions is, how can I get a unique absolute URL which allows me to perform a cross-platform HTTP redirection from a remote web page to a local file within a phonegap application?
Reltive paths should work:
index.html onError -> ./error.html
index.html onSuccess -> ./success.html
Or am I missing a server interaction like:
index.html -> http://someserver.com -> error.html
In this case the serverinterction have to be async.
Use Custom URL Schemes:
How it works: What's a redirect URI? how does it apply to iOS app for OAuth2.0?
PhoneGap and URL Schemes:
http://docs.build.phonegap.com/en_US/3.3.0/configuring_custom_urls.md.html#Custom%20URL%20Schemes
https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin
iOS SDK and Url Schemes
http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629