Progressive Web App - OAuth Login - Not working on iPhone
PWA OAuth Login
Problem:
I have a PWA
application which needs user authentication via Facebook/OAuth
.
The problem is that the OAuth
mechanism works in every circumstances but iPhone/Standalone
.
I need to find out some way to make a PWA
application works with Facebook/OAuth
on iPhone
. Is it possible? Yes
/No
?
Sample Project:
I created a sample project:
https://github.com/napolev/pwa-oauth-login
based on the article:
https://medium.com/@jonnykalambay/progressive-web-apps-with-oauth-dont-repeat-my-mistake-16a4063ce113
For simplicity, on this sample project, I replaced the Facebook/OAuth
mechanism with a simple Custom/OAuth
mechanism.
Code Preview:
index.html
<script>
...
window.open(
url_oauth + '?url_callback=' + encodeURIComponent(url_callback),
'Login Flow',
'width=350,height=250'
);
...
window.addEventListener('message', function (e) {
token.innerText = e.data.token;
})
...
</script>
...
<div>
Token: <span id="token">...</span>
</div>
callback.html
<script type="text/javascript">
// redirected to this page from the OAuth page
...
var data = {
token: ...,
};
window.opener.postMessage(data, ...);
window.close();
...
</script>
If I connect my Mac
to my iPhone
and do Remote Debugging
, I can see that when the method above: window.close();
gets called, it throws the following warning, which makes me feel very pesimistic about my possibilities:
Can't close the window since it was not opened by JavaScript
About the call: window.opener.postMessage(...)
that's another story and right now I don't have enough information about why is not sending
the token to the opener window. Probably it is because a similar issue as with: window.close();
.
Highlights:
I did a series of experiments and all of them came out fine, but the case: iPhone/Standalone
which failed because, even though a shorcut is added
to the home screen successfully and when you click it the app is opened properly without address bar, when the user clicks
the button: Start OAuth flow
a new window is opened, this time with an address bar (github.io
). Then, when the user clicks
the link: [APP-CALLBACK]
, the user is redirected to a the app callback url but this window doesn't send back the token to the opener
window and also it doesn't get closed. If I do this experiment on Android/Standalone
, this works fine. On top of that, on the same
iPhone
with Safari
(but not standalone) it works properly. The only problem I'm facing is on iPhone/Standalone
as you can see
on the following animated image.
Please, check the Experiments
section below for more details.
Project Download:
$ git clone https://github.com/napolev/pwa-oauth-login
$ cd pwa-oauth-login
$ npm i
$ npm run start
Test:
On your iPhone
(another device on the same network), go to:
http://[YOUR-SERVER-IP-ADDRESS]:4000
Installing as Standalone:
Android / Google Chrome - Click on the highlighted option to install the app as standalone.
iPhone / Safari - Click on the highlighted icons to install the app as standalone.
Experiments:
1- 2018-11-24 00:10 GMT
. On this commit, the OAuth
flow behaves as follows:
Windows + Chrome → SUCCESS
Windows + Firefox → SUCCESS
Windows + Edge → SUCCESS
Android + Chrome → SUCCESS
Android + Standalone → SUCCESS
Mac + Chrome → SUCCESS
Mac + Safari → SUCCESS
iPhone + Chrome → SUCCESS
iPhone + Safari → SUCCESS
iPhone + Standalone → !!! FAILURE !!!
javascript ios iphone oauth progressive-web-apps
|
show 4 more comments
PWA OAuth Login
Problem:
I have a PWA
application which needs user authentication via Facebook/OAuth
.
The problem is that the OAuth
mechanism works in every circumstances but iPhone/Standalone
.
I need to find out some way to make a PWA
application works with Facebook/OAuth
on iPhone
. Is it possible? Yes
/No
?
Sample Project:
I created a sample project:
https://github.com/napolev/pwa-oauth-login
based on the article:
https://medium.com/@jonnykalambay/progressive-web-apps-with-oauth-dont-repeat-my-mistake-16a4063ce113
For simplicity, on this sample project, I replaced the Facebook/OAuth
mechanism with a simple Custom/OAuth
mechanism.
Code Preview:
index.html
<script>
...
window.open(
url_oauth + '?url_callback=' + encodeURIComponent(url_callback),
'Login Flow',
'width=350,height=250'
);
...
window.addEventListener('message', function (e) {
token.innerText = e.data.token;
})
...
</script>
...
<div>
Token: <span id="token">...</span>
</div>
callback.html
<script type="text/javascript">
// redirected to this page from the OAuth page
...
var data = {
token: ...,
};
window.opener.postMessage(data, ...);
window.close();
...
</script>
If I connect my Mac
to my iPhone
and do Remote Debugging
, I can see that when the method above: window.close();
gets called, it throws the following warning, which makes me feel very pesimistic about my possibilities:
Can't close the window since it was not opened by JavaScript
About the call: window.opener.postMessage(...)
that's another story and right now I don't have enough information about why is not sending
the token to the opener window. Probably it is because a similar issue as with: window.close();
.
Highlights:
I did a series of experiments and all of them came out fine, but the case: iPhone/Standalone
which failed because, even though a shorcut is added
to the home screen successfully and when you click it the app is opened properly without address bar, when the user clicks
the button: Start OAuth flow
a new window is opened, this time with an address bar (github.io
). Then, when the user clicks
the link: [APP-CALLBACK]
, the user is redirected to a the app callback url but this window doesn't send back the token to the opener
window and also it doesn't get closed. If I do this experiment on Android/Standalone
, this works fine. On top of that, on the same
iPhone
with Safari
(but not standalone) it works properly. The only problem I'm facing is on iPhone/Standalone
as you can see
on the following animated image.
Please, check the Experiments
section below for more details.
Project Download:
$ git clone https://github.com/napolev/pwa-oauth-login
$ cd pwa-oauth-login
$ npm i
$ npm run start
Test:
On your iPhone
(another device on the same network), go to:
http://[YOUR-SERVER-IP-ADDRESS]:4000
Installing as Standalone:
Android / Google Chrome - Click on the highlighted option to install the app as standalone.
iPhone / Safari - Click on the highlighted icons to install the app as standalone.
Experiments:
1- 2018-11-24 00:10 GMT
. On this commit, the OAuth
flow behaves as follows:
Windows + Chrome → SUCCESS
Windows + Firefox → SUCCESS
Windows + Edge → SUCCESS
Android + Chrome → SUCCESS
Android + Standalone → SUCCESS
Mac + Chrome → SUCCESS
Mac + Safari → SUCCESS
iPhone + Chrome → SUCCESS
iPhone + Safari → SUCCESS
iPhone + Standalone → !!! FAILURE !!!
javascript ios iphone oauth progressive-web-apps
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
I just tried:document.location.href = ...
instead of:window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that theOAuth
service will always be on a different domain, so I start thinking that it is not possible to doOAuth
withPWA
oniPhone
. What do you think?
– davidesp
Nov 24 '18 at 2:41
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
2
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
1
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50
|
show 4 more comments
PWA OAuth Login
Problem:
I have a PWA
application which needs user authentication via Facebook/OAuth
.
The problem is that the OAuth
mechanism works in every circumstances but iPhone/Standalone
.
I need to find out some way to make a PWA
application works with Facebook/OAuth
on iPhone
. Is it possible? Yes
/No
?
Sample Project:
I created a sample project:
https://github.com/napolev/pwa-oauth-login
based on the article:
https://medium.com/@jonnykalambay/progressive-web-apps-with-oauth-dont-repeat-my-mistake-16a4063ce113
For simplicity, on this sample project, I replaced the Facebook/OAuth
mechanism with a simple Custom/OAuth
mechanism.
Code Preview:
index.html
<script>
...
window.open(
url_oauth + '?url_callback=' + encodeURIComponent(url_callback),
'Login Flow',
'width=350,height=250'
);
...
window.addEventListener('message', function (e) {
token.innerText = e.data.token;
})
...
</script>
...
<div>
Token: <span id="token">...</span>
</div>
callback.html
<script type="text/javascript">
// redirected to this page from the OAuth page
...
var data = {
token: ...,
};
window.opener.postMessage(data, ...);
window.close();
...
</script>
If I connect my Mac
to my iPhone
and do Remote Debugging
, I can see that when the method above: window.close();
gets called, it throws the following warning, which makes me feel very pesimistic about my possibilities:
Can't close the window since it was not opened by JavaScript
About the call: window.opener.postMessage(...)
that's another story and right now I don't have enough information about why is not sending
the token to the opener window. Probably it is because a similar issue as with: window.close();
.
Highlights:
I did a series of experiments and all of them came out fine, but the case: iPhone/Standalone
which failed because, even though a shorcut is added
to the home screen successfully and when you click it the app is opened properly without address bar, when the user clicks
the button: Start OAuth flow
a new window is opened, this time with an address bar (github.io
). Then, when the user clicks
the link: [APP-CALLBACK]
, the user is redirected to a the app callback url but this window doesn't send back the token to the opener
window and also it doesn't get closed. If I do this experiment on Android/Standalone
, this works fine. On top of that, on the same
iPhone
with Safari
(but not standalone) it works properly. The only problem I'm facing is on iPhone/Standalone
as you can see
on the following animated image.
Please, check the Experiments
section below for more details.
Project Download:
$ git clone https://github.com/napolev/pwa-oauth-login
$ cd pwa-oauth-login
$ npm i
$ npm run start
Test:
On your iPhone
(another device on the same network), go to:
http://[YOUR-SERVER-IP-ADDRESS]:4000
Installing as Standalone:
Android / Google Chrome - Click on the highlighted option to install the app as standalone.
iPhone / Safari - Click on the highlighted icons to install the app as standalone.
Experiments:
1- 2018-11-24 00:10 GMT
. On this commit, the OAuth
flow behaves as follows:
Windows + Chrome → SUCCESS
Windows + Firefox → SUCCESS
Windows + Edge → SUCCESS
Android + Chrome → SUCCESS
Android + Standalone → SUCCESS
Mac + Chrome → SUCCESS
Mac + Safari → SUCCESS
iPhone + Chrome → SUCCESS
iPhone + Safari → SUCCESS
iPhone + Standalone → !!! FAILURE !!!
javascript ios iphone oauth progressive-web-apps
PWA OAuth Login
Problem:
I have a PWA
application which needs user authentication via Facebook/OAuth
.
The problem is that the OAuth
mechanism works in every circumstances but iPhone/Standalone
.
I need to find out some way to make a PWA
application works with Facebook/OAuth
on iPhone
. Is it possible? Yes
/No
?
Sample Project:
I created a sample project:
https://github.com/napolev/pwa-oauth-login
based on the article:
https://medium.com/@jonnykalambay/progressive-web-apps-with-oauth-dont-repeat-my-mistake-16a4063ce113
For simplicity, on this sample project, I replaced the Facebook/OAuth
mechanism with a simple Custom/OAuth
mechanism.
Code Preview:
index.html
<script>
...
window.open(
url_oauth + '?url_callback=' + encodeURIComponent(url_callback),
'Login Flow',
'width=350,height=250'
);
...
window.addEventListener('message', function (e) {
token.innerText = e.data.token;
})
...
</script>
...
<div>
Token: <span id="token">...</span>
</div>
callback.html
<script type="text/javascript">
// redirected to this page from the OAuth page
...
var data = {
token: ...,
};
window.opener.postMessage(data, ...);
window.close();
...
</script>
If I connect my Mac
to my iPhone
and do Remote Debugging
, I can see that when the method above: window.close();
gets called, it throws the following warning, which makes me feel very pesimistic about my possibilities:
Can't close the window since it was not opened by JavaScript
About the call: window.opener.postMessage(...)
that's another story and right now I don't have enough information about why is not sending
the token to the opener window. Probably it is because a similar issue as with: window.close();
.
Highlights:
I did a series of experiments and all of them came out fine, but the case: iPhone/Standalone
which failed because, even though a shorcut is added
to the home screen successfully and when you click it the app is opened properly without address bar, when the user clicks
the button: Start OAuth flow
a new window is opened, this time with an address bar (github.io
). Then, when the user clicks
the link: [APP-CALLBACK]
, the user is redirected to a the app callback url but this window doesn't send back the token to the opener
window and also it doesn't get closed. If I do this experiment on Android/Standalone
, this works fine. On top of that, on the same
iPhone
with Safari
(but not standalone) it works properly. The only problem I'm facing is on iPhone/Standalone
as you can see
on the following animated image.
Please, check the Experiments
section below for more details.
Project Download:
$ git clone https://github.com/napolev/pwa-oauth-login
$ cd pwa-oauth-login
$ npm i
$ npm run start
Test:
On your iPhone
(another device on the same network), go to:
http://[YOUR-SERVER-IP-ADDRESS]:4000
Installing as Standalone:
Android / Google Chrome - Click on the highlighted option to install the app as standalone.
iPhone / Safari - Click on the highlighted icons to install the app as standalone.
Experiments:
1- 2018-11-24 00:10 GMT
. On this commit, the OAuth
flow behaves as follows:
Windows + Chrome → SUCCESS
Windows + Firefox → SUCCESS
Windows + Edge → SUCCESS
Android + Chrome → SUCCESS
Android + Standalone → SUCCESS
Mac + Chrome → SUCCESS
Mac + Safari → SUCCESS
iPhone + Chrome → SUCCESS
iPhone + Safari → SUCCESS
iPhone + Standalone → !!! FAILURE !!!
javascript ios iphone oauth progressive-web-apps
javascript ios iphone oauth progressive-web-apps
edited Nov 24 '18 at 2:07
davidesp
asked Nov 24 '18 at 0:27
davidespdavidesp
678520
678520
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
I just tried:document.location.href = ...
instead of:window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that theOAuth
service will always be on a different domain, so I start thinking that it is not possible to doOAuth
withPWA
oniPhone
. What do you think?
– davidesp
Nov 24 '18 at 2:41
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
2
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
1
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50
|
show 4 more comments
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
I just tried:document.location.href = ...
instead of:window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that theOAuth
service will always be on a different domain, so I start thinking that it is not possible to doOAuth
withPWA
oniPhone
. What do you think?
– davidesp
Nov 24 '18 at 2:41
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
2
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
1
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
I just tried:
document.location.href = ...
instead of: window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that the OAuth
service will always be on a different domain, so I start thinking that it is not possible to do OAuth
with PWA
on iPhone
. What do you think?– davidesp
Nov 24 '18 at 2:41
I just tried:
document.location.href = ...
instead of: window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that the OAuth
service will always be on a different domain, so I start thinking that it is not possible to do OAuth
with PWA
on iPhone
. What do you think?– davidesp
Nov 24 '18 at 2:41
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
2
2
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
1
1
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50
|
show 4 more comments
2 Answers
2
active
oldest
votes
What about using a server-side proxy, so the PWA never leaves its scope and the server does all the OAuth work in the background?
https://medium.com/@madumalt/oauth2-proxy-for-single-page-applications-8f01fd5fdd52
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
add a comment |
Remove the manifest when loading the application on an iOS device as discussed here.
var iOS = !!navigator.platform && /i(Phone|Pad|Pod)/.test(navigator.platform);
if (iOS) {
document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454186%2fprogressive-web-app-oauth-login-not-working-on-iphone%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
What about using a server-side proxy, so the PWA never leaves its scope and the server does all the OAuth work in the background?
https://medium.com/@madumalt/oauth2-proxy-for-single-page-applications-8f01fd5fdd52
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
add a comment |
What about using a server-side proxy, so the PWA never leaves its scope and the server does all the OAuth work in the background?
https://medium.com/@madumalt/oauth2-proxy-for-single-page-applications-8f01fd5fdd52
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
add a comment |
What about using a server-side proxy, so the PWA never leaves its scope and the server does all the OAuth work in the background?
https://medium.com/@madumalt/oauth2-proxy-for-single-page-applications-8f01fd5fdd52
What about using a server-side proxy, so the PWA never leaves its scope and the server does all the OAuth work in the background?
https://medium.com/@madumalt/oauth2-proxy-for-single-page-applications-8f01fd5fdd52
answered Nov 24 '18 at 4:40
vrtjasonvrtjason
29518
29518
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
add a comment |
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
Has anyone being able to find a solution for the redirect issue on ios?
– Alexei S.
Jan 16 at 11:11
add a comment |
Remove the manifest when loading the application on an iOS device as discussed here.
var iOS = !!navigator.platform && /i(Phone|Pad|Pod)/.test(navigator.platform);
if (iOS) {
document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
}
add a comment |
Remove the manifest when loading the application on an iOS device as discussed here.
var iOS = !!navigator.platform && /i(Phone|Pad|Pod)/.test(navigator.platform);
if (iOS) {
document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
}
add a comment |
Remove the manifest when loading the application on an iOS device as discussed here.
var iOS = !!navigator.platform && /i(Phone|Pad|Pod)/.test(navigator.platform);
if (iOS) {
document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
}
Remove the manifest when loading the application on an iOS device as discussed here.
var iOS = !!navigator.platform && /i(Phone|Pad|Pod)/.test(navigator.platform);
if (iOS) {
document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
}
answered Jan 28 at 18:34
Josh LaMarJosh LaMar
707
707
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454186%2fprogressive-web-app-oauth-login-not-working-on-iphone%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your problem is that you cannot associate a custom url scheme to a web shortcut added to the home screen for use as the callback URL. Using a "http/s" URL as you are doing results in the callback being opened in the current Safari environment. The only way you might get it to work is if you can open the OAuth page in your current web view, not in a new window.
– Paulw11
Nov 24 '18 at 2:07
I just tried:
document.location.href = ...
instead of:window.open(...)
and it also opened Safari out of the standalone mode. I think it does that because it is another domain. But the point is that theOAuth
service will always be on a different domain, so I start thinking that it is not possible to doOAuth
withPWA
oniPhone
. What do you think?– davidesp
Nov 24 '18 at 2:41
I agree. That is why I said "you might get it work". To be honest if you want to deliver a native app experience on iOS you have to write a native app. I don't think Apple is really a big fan of PWA
– Paulw11
Nov 24 '18 at 2:50
2
Any new findings? I am highly interested in this as it seems to be one of the major negative points in my case too.
– Tobias
Dec 16 '18 at 10:48
1
Wouldn't it be possible to embed an iframe for the oauth flow?
– Tobias
Dec 16 '18 at 10:50