From https://stackoverflow.com/a/57933248/3390

func HandleCallback(url: URL) {
    var components = URLComponents()
    components.query = url.fragment
    
    accessToken = components.queryItems?.first(where: { $0.name == "access_token"})?.value
}