-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOC] Missing mobile guidelines #30
Comments
Hi @PhilippRoessner, thanks for the kind words! This library clearly lacks documentation.. sorry about that. Meanwhile, you can have a look at the getting-started/providers page, where you have all the necessary settings that needs to be set in your IDP. For mobile to work, you have to allow this two urls:
Where demo-app is the
You will also have to install these packages:
Do not hesitate to have a look at the capacitor demo-app. The warning is about a work in progress and can be safely ignored right now. |
I followed the guidelines so far (for Android) and I compared with what I've found in the demo application. Unfortunately the Mobile implementation is not working yet. The Browser opens and after the login it goes back to my app. But it seems like the app is not picking up the token etc. I found this in the log:
I am subscribing to a few observables of the AuthService (userSession$, accessToken$) but they never fire. The Webapp with Angular is working fine. Do you have an idea what I could be missing? |
You can enable the log within the library like this: import { initAuth, Log } from '@badisi/ngx-auth';
initAuth({
logLevel: Log.DEBUG
}); Then open a Chrome browser and type the following address: Have a look at those logs (especially the ones from You can also copy/paste them here so I can have a look. |
Sorry for the bad format, here is the log: (interesting stuff seems to be at the end of the log) Logs[UserManager] getUser: user not found in storage
/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
main.a24512a315ae2891.js:1 [@badisi/auth-js] This application is currently using a non recommended browser plugin.
ⓘ Please follow the recommended guide and use `@badisi/capacitor-browsertab` instead.
(anonymous) @ main.a24512a315ae2891.js:1
prepare @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
t @ polyfills.b22312040db39e45.js:1
Z @ main.a24512a315ae2891.js:1
signinMobile @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
t @ polyfills.b22312040db39e45.js:1
Z @ main.a24512a315ae2891.js:1
login @ main.a24512a315ae2891.js:1
login @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
n.subscribe.s @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
_subscribe @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
_subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
p @ main.a24512a315ae2891.js:1
h @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
rC @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
y0 @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
y0 @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
n.subscribe.s @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
p @ main.a24512a315ae2891.js:1
h @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
rC @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
p @ main.a24512a315ae2891.js:1
h @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
rC @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
p @ main.a24512a315ae2891.js:1
h @ main.a24512a315ae2891.js:1
_next @ main.a24512a315ae2891.js:1
next @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_complete @ main.a24512a315ae2891.js:1
complete @ main.a24512a315ae2891.js:1
_complete @ main.a24512a315ae2891.js:1
complete @ main.a24512a315ae2891.js:1
_complete @ main.a24512a315ae2891.js:1
complete @ main.a24512a315ae2891.js:1
f @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_complete @ main.a24512a315ae2891.js:1
complete @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
_trySubscribe @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
w @ main.a24512a315ae2891.js:1
subscribe @ main.a24512a315ae2891.js:1
(index):243 native Browser.addListener (#11860707)
(index):243 native Browser.open (#11860708)
(index):217 result Browser.open (#11860708)
(index):217 result Browser.addListener (#11860707)
main.a24512a315ae2891.js:1 [MobileWindow] navigate: error response: Capacitor browser closed by user
error @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
t @ polyfills.b22312040db39e45.js:1
Z @ main.a24512a315ae2891.js:1
onError @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
returnResult @ (index):761
win.androidBridge.onmessage @ (index):731
(index):243 native Browser.removeListener (#11860709)
(index):243 native Browser.close (#11860710)
(index):217 result Browser.close (#11860710)
main.a24512a315ae2891.js:1 [MobileWindow] close: Error: not implemented
at returnResult ((index):756:32)
at win.androidBridge.onmessage ((index):731:21)
error @ main.a24512a315ae2891.js:1
(anonymous) @ main.a24512a315ae2891.js:1
invoke @ polyfills.b22312040db39e45.js:1
run @ polyfills.b22312040db39e45.js:1
(anonymous) @ polyfills.b22312040db39e45.js:1
invokeTask @ polyfills.b22312040db39e45.js:1
runTask @ polyfills.b22312040db39e45.js:1
_ @ polyfills.b22312040db39e45.js:1
Promise.then (async)
q @ polyfills.b22312040db39e45.js:1
R @ polyfills.b22312040db39e45.js:1
scheduleTask @ polyfills.b22312040db39e45.js:1
scheduleTask @ polyfills.b22312040db39e45.js:1
scheduleMicroTask @ polyfills.b22312040db39e45.js:1
ee @ polyfills.b22312040db39e45.js:1
z @ polyfills.b22312040db39e45.js:1
(anonymous) @ polyfills.b22312040db39e45.js:1
(anonymous) @ polyfills.b22312040db39e45.js:1
returnResult @ (index):773
win.androidBridge.onmessage @ (index):731
(index):243 native Browser.close (#11860711)
(index):217 result Browser.close (#11860711)
main.a24512a315ae2891.js:1 [MobileWindow] close: Error: not implemented
at returnResult ((index):756:32)
at win.androidBridge.onmessage ((index):731:21) |
Sorry but those logs are not helping.. (nothing important in there). Also they are a lot missing. Look at what I have on my side (clearly more info about what's going on in the lib): Two more things:
|
I gave it another shot with the demo-app and it worked perfectly. Then I began to compare everything and noticed that the package @capacitor/app was missing in my project. It works now perfectly for android. Big Thanks and again Kudos for this project! This is was my expectation on how to implement oAuth into my hybrid app 3 years ago. My Macbook is currently not ready for development but my colleague is going to try the ios part in the next few days. I'm sure it should be fine :-) |
Glad you got it working on Android 😉 |
I just fixed it now, forgot the url scheme in ios (not enough coffee yet lol)
|
Yes it was part of what I told you to do ☕ 😅 |
Anyway, enjoy the lib now and thanks again for the support 😊 |
Hello @mordechai-s! Thanks for the kind words 😊
Are you facing any issue with these errors ? |
@Badisi Thanks for your response. No, I'm not facing any issues with these errors, I just wanted to know what they are. 2 more questions,
Thanks again |
@mordechai-s
ExplanationOn desktop On mobile
Regarding your question 2., |
Does the library use the system browser or an in-app browser like Custom Tabs on Android for login? it looks like the user is leaving the app when login, is that the way it is supposed to work? |
This library will never use the "system browser" as it is not considered a best practice. Right now the library is expecting |
Documentation can be submitted with pull requests
Docs URL
https://badisi.github.io/auth-js/site/documentation/getting-started/mobile
Description
First I'd like to thank you for this great library! It is exactly what I was waiting for!
I am trying to migrate from a complicated mix of oidc-client-ts for web (angular) and ionic-appauth for our capacitor app to this solution. So far the Web Part works great as a proof of concept.
When I try to login on the android capacitor app, I get the following warning in the console:
When I look at the code, it seems like this is not required, is that right?
My Authprovider (Identity Server 4) throws an error when I am using the capacitor android client and I am wondering if this might be connected? I remember from my previous implementations that the url scheme was handled differently on ios and on android. One of them had to use "capacitor://" and the other "localhost://" or something like that.
Currently I set the mobileScheme property on the parameter object for initAuth and the same value for the intent-filter in the androidmanifest.xml. Is that all it takes?
The text was updated successfully, but these errors were encountered: