MCPcopy Create free account
hub / github.com/plexdrive/plexdrive / LoadToken

Method LoadToken

drive/cache.go:90–105  ·  view source on GitHub ↗

LoadToken loads a token from cache

()

Source from the content-addressed store, hash-verified

88
89// LoadToken loads a token from cache
90func (c *Cache) LoadToken() (*oauth2.Token, error) {
91 Log.Debugf("Loading token from cache")
92
93 tokenFile, err := ioutil.ReadFile(c.tokenPath)
94 if nil != err {
95 Log.Debugf("%v", err)
96 return nil, fmt.Errorf("Could not read token file in %v", c.tokenPath)
97 }
98
99 var token oauth2.Token
100 json.Unmarshal(tokenFile, &token)
101
102 Log.Tracef("Got token from cache %v", token)
103
104 return &token, nil
105}
106
107// StoreToken stores a token in the cache or updates the existing token element
108func (c *Cache) StoreToken(token *oauth2.Token) error {

Callers 1

authorizeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected