Skip to content

ASWebAuthenticationSession Support#226

Open
sampaxk wants to merge 4 commits into
capacitor-community:developfrom
sampaxk:ASWebAuthenticationSession_Support
Open

ASWebAuthenticationSession Support#226
sampaxk wants to merge 4 commits into
capacitor-community:developfrom
sampaxk:ASWebAuthenticationSession_Support

Conversation

@sampaxk

@sampaxk sampaxk commented Jan 17, 2023

Copy link
Copy Markdown

Switched the authentication method from SafariURLHandler to ASWebAuthenticationURLHandler.
Implemented ASWebAuthenticationPresentationContextProviding in the OAuth2ClientPlugin class.

// if the user touches "done" in safari without entering the credentials the USER_CANCELLED error is sent #71
urlHandler.delegate = self.oauth2SafariDelegate
let urlHandler = ASWebAuthenticationURLHandler(
callbackUrlScheme: redirectUrl.replacingOccurrences(of: "://oauth", with: ""),

@narcis-ro narcis-ro Mar 15, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be?

callbackUrlScheme: URL(string: redirectUrl)!.scheme!,

So it works with any host url? e.g ://auth

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be as you've written. I've not tested it with other host urls but it should with any url.

@NoobleMcScrunchkin

Copy link
Copy Markdown

This PR looks like its gone a little bit quiet. I would love to see this one brought up to date and completed.

@moberwasserlechner moberwasserlechner changed the base branch from main to develop July 26, 2025 21:45
@lazerwalker

Copy link
Copy Markdown

Another +1, I'd love to see this get merged in sooner rather than later. Happy to help get it up-to-date with latest main and/or help with feedback if there's any indication the maintainers would merge.

@HarelM

HarelM commented Dec 1, 2025

Copy link
Copy Markdown

Any update on this one?
I'm looking into migrating from cordova-plugin-oauth to something more capacitor native.
The things that I noticed that are different are:

  1. This PR (ASWebAuthenticationSession).
  2. CustomTabs for Android.

The code can be found here:
https://github.com/AyogoHealth/cordova-plugin-oauth/blob/main/src/ios/OAuthPlugin.swift
https://github.com/AyogoHealth/cordova-plugin-oauth/blob/main/src/android/OAuthPlugin.java

There's not much there, but I think it's more secure and modern.
The other plugin causing compilation warnings due to support for very old iOS versions, which is not what I want for my app, see here: AyogoHealth/cordova-plugin-oauth#48.

I'll be happy to open a PR if this will help push things forwards.
@lazerwalker @NoobleMcScrunchkin @sampaxk what did you end up doing? Are you using a different plugin?

@lazerwalker

Copy link
Copy Markdown

My usecase doesn't have a strict requirement to use ASWebAuthenticationSession, it's just a nice-to-have, so I'm currently still using this library as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants