oauth2
                                
                                 oauth2 copied to clipboard
                                
                                    oauth2 copied to clipboard
                            
                            
                            
                        Make RetrieveToken usable by client packages
I'm working on a client that needs to refresh tokens in a special way, so I'm implementing my own TokenSource. The strange thing seems to be that, although the TokenSource interface is exported, I can't actually reuse the provided logic to refresh a token, as retrieveToken is unexported and it calls an internal-only function: internal.RetrieveToken(), even though all the parameters are exported values too.
https://github.com/golang/oauth2/blob/c453e0c757598fd055e170a3a359263c91e13153/token.go#L154
I'd like to use either retrieveToken() or internal.RetrieveToken() as I'm essentially wrapping it differently than the built-in token refresher.
Can we potentially export retrieveToken() or make internal.RetrieveToken() usable by external packages?
Figured out another way to do this in the meantime
I'm trying to do something similar, what was your way to do it if you can share it?
Uhhh wow, 5 years ago, I don't really remember :sweat_smile:
I think I was working on this project at the time, so you may find some hints in this file: https://github.com/mholt/timeliner/blob/cf155164e218ca1ad6ad600152cd2436c88dba43/oauth2.go#L41 -- not 100% sure it worked correctly but I think it did work for me. :man_shrugging:
Thank you for your response, I've reused existing API and write some comments about it to my future self.
On Tue, Jun 6, 2023, 18:28 Matt Holt @.***> wrote:
Reopened #354 https://github.com/golang/oauth2/issues/354.
— Reply to this email directly, view it on GitHub https://github.com/golang/oauth2/issues/354#event-9448433369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACVLV6FX5UREKULX3GUQTXJ5LDLANCNFSM4GLRKGVQ . You are receiving this because you commented.Message ID: @.***>