question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] [swift5] Update the Swift 5 bearer token authentication examples

See original GitHub issue

The following examples are outdated with respect to the current Swift 5 implementation. The primary issue here is that the execute method nowadays returns URLSessionTask? whereas the examples are working with Void as the return type.

I’ve tried to update the examples to get a working implementation myself, alas, I don’t quite understand how to do it.

@4brunu

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
4brunucommented, Dec 1, 2021

I think I found a solution inspired in RxSwift/Combine, instead of returning URLSessionTask we would return a OpenAPIRequestCancelable, similar to Combine AnyCancellable, that have a private property URLSessionTask that is updated accordingly to the current request. What do you think? I will try to create a draft to see if this works. By the way, @jarrodparkes if you want to help with this, you are welcome 🙂

0reactions
denizdogancommented, Dec 1, 2021

@4brunu I appreciate your efforts with this! However, I’m still too new to all of this to really be the judge of what makes a good solution. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Implement Basic Authentication in Swift - Cocoacasts
In this episode, you learn how to authenticate a user using basic authentication, or basic auth for short, in Swift. We use the...
Read more >
How to program the refresh token logic when using Swift ...
Basically, if I get 401 in any request, I try to download the access token using the refresh token. If unauthorized, I logout...
Read more >
Swift 5 URLRequest authorization header: reserved, how to set?
Here, token is a method as an example to authenticate a user. I pass something like that from the UI to this method...
Read more >
Building a token refresh flow with async/await and Swift ...
Refreshing authentication tokens is something that a lot of us deal with regularly, and doing it correctly can be a pretty challenging task....
Read more >
Authentication with signed requests in Alamofire 5 - SwiftLee
In this example, we're adding a JSON Web Token (JWT) as an authentication header to each request that requires to be authenticated.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found