Skip to content

Support for web APIs that require permissions #81

Closed

Description

@nklayman

Is your feature request related to a problem? Please describe.
Currently (at least on Linux), doing any action that requires permission (such as geolocation) fails as the permission request is immediately denied.

Describe the solution you'd like
There should be a way to specify what permissions the app should have so they are automatically allowed.

Would you assign yourself to implement this feature?

  • Yes (at least for Linux and maybe windows)
  • No

Additional context
For linux: https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-permission-request

Activity

  1. changed the title [-]Support for actions that require permissions[/-] [+]Support for web APIs that require permissions[/+] on Feb 25, 2021
  2. wusyong commented on Apr 20, 2021

    @wusyong
    Member

    We also already enable some permissions required featured like clipboard on Windows already.
    https://github.com/tauri-apps/wry/blob/dev/src/webview/win32/mod.rs#L154

    I couldn't find similar option on mac. And it seems lots of permission related features are not available to WkWebView.
    Edit: looks like this is an on-going feature to be implemented. Future custom protocol will be treated as secure content.
    https://bugs.webkit.org/show_bug.cgi?id=220184

  3. nothingismagick commented on Apr 21, 2021

    @nothingismagick
    SponsorMember

    I think we did as good as we can do here, especially now that webrtc is working on macos, i think we are good.

  4. lemarier commented on Apr 21, 2021

    @lemarier
    Member

    We should try with the localhost fix as it use same engine as macOS webview

  5. wusyong commented on Apr 21, 2021

    @wusyong
    Member

    Reopen it until the PR is delivered

  6. nklayman commented on Apr 29, 2021

    @nklayman
    MemberAuthor

    It appears that PR didn't quite solve the issue I was referring to. There still doesn't seem to be a way to allow prompting for web APIs such as geolocation. If you try to use it inside Tauri (on Linux at least) it just fails immediately. If you use epiphany which also uses webkit2gtk, it prompts for location permissions. I think we should offer a way to prompt for or automatically allow certain permissions.

  7. kantum commented on May 2, 2022

    @kantum

    Hello,

    I have a WebRTC app that I would like to make it work with tauri. Would love to see this issue going forward!

  8. kevinelliott commented on Jun 22, 2022

    @kevinelliott

    What's the status of this? Need to use geolocation in a tauri app and noticing that it doesn't work.

  9. cliqer commented on Jul 4, 2022

    @cliqer

    It seems this is responsible for navigator.mediaDevices.getDisplayMedia not working too.
    We are stuck on porting to tauri because of this...

  10. FabianLars commented on Sep 16, 2022

    @FabianLars
    Member

    @cliqer getDisplayMedia is not supported in WKWebView at all right now. No promises (just an idea), but we probably could do something similar to electron and inject it in getUserMedia, but don't hold your horses :/

    I wanted to sent this comment a few weeks/months ago but something went wrong, anyway here it is, but i can't find the source for this right now, gonna update this comment if i find it again.

  11. cliqer commented on Sep 17, 2022

    @cliqer

    @FabianLars Indeed it is not :/ and unfortunately, this has stopped us from porting our application to tauri for the time being.

    The alternative at the moment, like building webrtc and adding an egui for screen capturing display selection within the rust layer, is almost impossible for us.

    Many thanks and please do something similar to electron.
    Waiting eagerly for the implementation.

  12. mhsfh commented on Dec 24, 2022

    @mhsfh

    is there any update ? i need to use Geolocation

  13. petermakeswebsites commented on Apr 23, 2023

    @petermakeswebsites

    I would also like to use the microphone. MacOS. Looking through my inspector with permissions api, it says the microphone permission is set to "prompt", implying that the web might be thinking the prompt dialogue is showing when it isn't. When I try to start the dictation anyway, the console puts the error: Speech recognition error - "not-allowed". It works fine on Safari after I accept the permission prompt, which is either hidden or doesn't exist in Tauri. I would really appreciate having some kind of solution to this because dictation is central to my application.

  14. wusyong commented on Apr 24, 2023

    @wusyong
    Member

    I think we should split this into smaller issues. The problems each user face is not the same. And each platform will need some extra works too. I believe we will need Infoplist on macOS for example.
    If you are interested in specific feature, please consider open an issue and hopefully a working wry example.
    We'll try to look into further if someone has time.

  15. kevinelliott commented on Jul 28, 2023

    @kevinelliott

    I think we should split this into smaller issues. The problems each user face is not the same. And each platform will need some extra works too. I believe we will need Infoplist on macOS for example. If you are interested in specific feature, please consider open an issue and hopefully a working wry example. We'll try to look into further if someone has time.

    How about start with geolocation :)

  16. ajayghoshcmonk commented on Mar 30, 2024

    @ajayghoshcmonk

    Any update on this ?

  17. shubh57 commented on Mar 17, 2025

    @shubh57

    Has this issue been resolved, if so how can i get geolocation of user in desktop application, I came across a crate tauri-plugin-geolocation but it only supports android and ios.

  18. FabianLars commented on Mar 17, 2025

    @FabianLars
    Member

    if this had been (completely) solved the issue would be closed.

    Note that geolocation should already work at least on Windows and macOS without this issue being resolved. The behavior is just different. On Windows it should prompt the user for permissions via a small window (like in Edge) and on macOS it will probably ask the user for permission twice similar to https://stackoverflow.com/questions/39665367/how-to-prevent-wkwebview-to-repeatedly-ask-for-permission-to-access-location/43907448 (one will always be shown, the second one would be removed as part of this gh issue).

    To test macOS:

    I may be missing something but i've seen Tauri apps on desktop with working geolocation so it should generally be possible.


    P.S. i started working on it here https://github.com/tauri-apps/wry/tree/feat/permission-request but lost motiviation when it came to macOS and an actual user facing api 🤷

  19. ddompe commented on Apr 15, 2025

    @ddompe

    Hi @FabianLars I just tried this approach you mentioned of using NSLocationUsageDescription (using embed_plist for the dev version and in the build) and I can't get geolocation to work in my Tauri app. I did the experiment of opening an WebRTC test page in my app to compare with/without the Info.plist and I could see how it didn't asked for permissions without it, and then showed up the native dialog asking for permissions when I put the right entries for Mic/Camera on the plist. If I test my Vue app on the browser geolocation works as expected, so something is odd with the wkwebview integration for it.

  20. ImBoop commented on Aug 14, 2025

    @ImBoop

    Allowing us to provide a handler or using the built in permissions system to permit us to be able to use i.e. the geolocation API without it prompting would be great.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions