Code Monkey home page Code Monkey logo

Comments (5)

makarski avatar makarski commented on September 28, 2024 1

@adnanjpg thank you pointing this out. Let me test the scenarios you mentioned and hopefully we can find a good solution. So far I've been using the the serv_account module in this project with tokio runtime https://github.com/makarski/mstream/blob/main/src/cmd/listener.rs#L24-L25. However, the dependency there is gauth = 0.4 that is using a version of reqwest before async was introduced.

Before the issue is fixed, a version 0.4 will do, as the changes introduced in 0.5 affect the desktop app auth - there i also updated the reqwest client that introduced the issue.

from gauth-rs.

makarski avatar makarski commented on September 28, 2024 1

Also always looking forward to have a PR opened

from gauth-rs.

adnanjpg avatar adnanjpg commented on September 28, 2024

as suggested in this stackoverflow answer, running the from_file function on a seperate thread fixes the issue

use std::thread;

#[tokio::main]
async fn main() {
    thread::spawn(|| {
        gauth::serv_account::ServiceAccount::from_file(
            "service-account-key.json",
            vec!["https://www.googleapis.com/auth/firebase.messaging"],
        );
    })
    .join()
    .expect("Thread panicked")
}

from gauth-rs.

adnanjpg avatar adnanjpg commented on September 28, 2024

after investigation, the actual reason for this error is the usage reqwest::blocking::Client, as that apparently interferes with the threads that tokio is supposed to manage.

converting all necessary to async actually fixes the problem.

however, using async functions breaks the tests, as per my research it appaears that an external async test library is required.

if you're interested, I can open a pr with the current work

from gauth-rs.

adnanjpg avatar adnanjpg commented on September 28, 2024

sure, here's the pr #26

from gauth-rs.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.