browserInApp issue with Google OAuth in quasar+feathers app - node.js

Scenario:
I’m building Spa end Android app with quasarjs.
The backend is a feathers-js server with the feathers-js-oauth plugin for authentication.
I am using an SQLite database to store users.
I set up Facebook and Google oauth2 login, and it works in Spa mode with simple hypertext link “/oauth/google” in quasar
https://docs.feathersjs.com/api/authentication/oauth2.html#client-usage
Usually, for OAuth Cordova, people use “browserinapp” plugin that opens a pop-up for oauth2 authentication to fetch the token.
The problem is that Google dropped support for browserInApp user agent as you can see here https://github.com/nraboy/ng-cordova-oauth/issues/283
Did anyone have the same issue? How to solve?
I see some people use firebase, but can I use it only for authentication? I would like to maintain my server app with user collection.

I have the same problem. Temporarily fix the problem in a non-optimal way
add a timeout of 2 seconds inside the signInWithRedirect () method and then get the result getRedirectResult ()
Only works in production mode
I opened a case at https://github.com/quasarframework/quasar-cli/issues/186

Related

Not able to store cookie on ios device in ionic 3 app

I'm working on a ionic project and api made in nodejs with sails. Login api is uses the waterlock authentication and send the cookie in header that saved on machine and next time when i hit any other api it will authenticate me using that cookie.
Issue 1:- But i'm facing the issue on safari that safari does not allow me to save the cookie. for allow the cookie i need to change the safari settings after that it's working fine.
Issue 2:- As i said i'm working on ionic 3 app so i'm using tough-cookie in the app to handle the cookie thing and it's working fine on android and browser but it does not working in ios. it does not allow me to save the cookie.
Does anyone have the solution for this? Please help me!!!
that is a known problem of the wkwebview, but there is a solution using the following plugin, you can read more about this in the github thread.
https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/22#issuecomment-398036017

How can I verify android app's GPGS token on my node.js server using passport

I've developed a game client(Android) and server using Unity and node.js.
The log-in function of the server is implemented using passport.js. It was simple, so I didn't worry about anything. I was supposed to implement log-in feature in my game by popping up the in app browser.
But it turns out android games need to use "Google Play Game Service" to log in to Google. I confused how to use passport.js in this case.
The sequence of the Google OAuth2.0 login I know is roughly as follows.
Game client request "authenticate" to GPGS using "google-games-plugin-for-unity"
If login success, game client can get "Authorization Code" using "GetIdToken()" api.
Game client send this token to my game server.
Game server verify the token(from step3) through Google api service.
If verifying success, my server can get user infos and access token.
Fully login complete.
I am wondering how to implement step3 and onwards using passport.js.
Can I use passport.js to implement this with only "GoogleStrategy" configuration? How?
I found a solution myself. There was something wrong what I knew. The sequence of the Google OAuth2.0 is right as above except one thing.
I thought I could get the "Authorization Code" by using "GetIdToken()" api of "google-games-plugin-for-unity". But, if I wanna get the "Authorization Code", I had to use "GetServerAuthCode()", not to use "GetIdToken()". This description was in ReadME of "google-games-plugin-for-unity" github. It was my fault that I didn't read it in detail.
IdToken and AuthCode are not same, it is the part what I didn't know correctly. (See "Retrieving server authentication codes" of https://github.com/playgameservices/play-games-plugin-for-unity#retrieving-server-authentication-codes )
Now, game client can get "Authorization Code" well using "GetServerAuthCode()", and game client make url to send this token to game server as bellow.(using get, but google recommend using post)
var _url = "YOUR://WEBAPP/REDIRECTION/URL?code="+ PlayGamesPlatform.Instance.GetServerAuthCode();
Game server will get this url and the server can use "passport.authenticate" which is the same way when it get redirection url from web browser.
If your both user auth info(android app and web app) are registered in same Google API console project, they will share auth info and the login procedure will perform same like using browser case.

Do i need to setup a server to use spotifys authorization code flow?

I am using Electron to create an app for my raspberry pi to run and i want to be able to use my spotify playlists but i am having a little trouble using their api. I need to use their authorization code flow which grants you an access token after you login in. My question is, do i need to have my app running on a server (in localhost) in order to be able to make use of the spotify api ? I started playing around with Express but i am still not quite sure what i am doing or need to do.
Has anyone done this before or have any advice?
Are there any nodejs modules that help with this kind of authentication?

authentication with a third party provider

I'm developing an api server in (NodeJs/ hapi) coupled with an android application.
I'm having a problem understanding how to do login via a third party like google and facebook.
So far my strategy is:
authorize my app(android)
get the email and other data from google/facebook(android)
Send email and data to my server and save it in a database(server)
Next time when authentication. I'll just check the same data(from google) against the save data(my server).
I'm pretty sure there is a better way to do it, but the documentation I have read so far leave me with a head ache.
Help is appreciated.
I just setup a demo project using ExpressJS.
It would be interesting to have a fork for Hapi.
Check it out if want: http://git.io/RHnjBg

Log out the user on the iOS 4 with HTTPBasicAuthentication

I am programming an iPhone application. My (existing) web-application uses Ruby on Rails (2.3.2) to serve the data. Ruby on Rails backend uses restful-authentication gem to authenticate the users.
To get user data from the server to the iPhone app I use HTTPRiot framework and authenticate user with HTTPBasicAuthentication.
Now everything works fine - user can get and post some data to and from the iPhone app. But when I want to log out the user from the service it seems impossible. From the different topics I understood that logout was just not implemented in HTTPBasicAuthentication and I completely OK with that. I tried to find a work around like implementing a switch in the Settings.app to force my app to display the login screen when user goes back to the app.
The problem is: iOS4 keeps connection kind of "open" when app is entering background. To log out from HTTPBasicAuthenticated connection, this connection needs to be broken. Using this approach my user needs to quit the app, turn the switch on in the Settings.app, delete my app from multitasking and start my app again. This is too dirty.
My question is: is there a cleaner way to logout/change the user without completely leaving the application?
Some references: HTTPRiot, Logout and basic auth, Logout and basic auth 2

Resources