Peter-Schorn / SpotifyAPI

A Swift library for the Spotify web API. Supports all endpoints.
https://peter-schorn.github.io/SpotifyAPI/documentation/spotifywebapi
MIT License
270 stars 33 forks source link

Unclear where to put `requestAccessAndRefreshTokens(redirectURIWithQuery:state:)` #68

Open Nightmare987 opened 2 days ago

Nightmare987 commented 2 days ago

i am following the tutorial to use authorization code flow, but do not know where to put the requestAccessAndRefreshTokens(redirectURIWithQuery:state:) code block. i tried searching in the example-app, but couldnt find it.

Peter-Schorn commented 2 days ago

It's here in RootView:

https://github.com/Peter-Schorn/SpotifyAPIExampleApp/blob/837e5885a347385d8f15fabbac2bbbcc5e50c58b/SpotifyAPIExampleApp/Views/RootView.swift#L43-L114

Peter-Schorn commented 2 days ago

See also How the Authorization Process Works.

Nightmare987 commented 1 day ago

but i cant just copy paste that whole block of code, so what do i do to impliment it into my project?

Peter-Schorn commented 17 hours ago

Which UI framework are you using? SwiftUI, UIKit, or AppKit? If you're using SwiftUI, is the entry point to your app a type that conforms to App (the SwiftUI lifecycle) or is it an AppDelegate class that conforms to UIApplicationDelegate/NSApplicationDelegate? If you're using UIKit, do you have a SceneDelegate? I need more information about your project in order to answer this question.