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

Method StoreToken

drive/cache.go:108–123  ·  view source on GitHub ↗

StoreToken stores a token in the cache or updates the existing token element

(token *oauth2.Token)

Source from the content-addressed store, hash-verified

106
107// StoreToken stores a token in the cache or updates the existing token element
108func (c *Cache) StoreToken(token *oauth2.Token) error {
109 Log.Debugf("Storing token to cache")
110
111 tokenJSON, err := json.Marshal(token)
112 if nil != err {
113 Log.Debugf("%v", err)
114 return fmt.Errorf("Could not generate token.json content")
115 }
116
117 if err := ioutil.WriteFile(c.tokenPath, tokenJSON, 0644); nil != err {
118 Log.Debugf("%v", err)
119 return fmt.Errorf("Could not generate token.json file")
120 }
121
122 return nil
123}
124
125// GetObject gets an object by id
126func (c *Cache) GetObject(id string) (object *APIObject, err error) {

Callers 1

authorizeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected