MCPcopy Create free account
hub / github.com/AndroidPoet/playconsole-cli / GetCredentials

Function GetCredentials

internal/config/config.go:140–164  ·  view source on GitHub ↗

GetCredentials returns the service account credentials JSON

()

Source from the content-addressed store, hash-verified

138
139// GetCredentials returns the service account credentials JSON
140func GetCredentials() ([]byte, error) {
141 if currentProfile == nil {
142 return nil, fmt.Errorf("no profile configured. Run 'playconsole-cli auth login' first")
143 }
144
145 // Try base64 encoded credentials first
146 if currentProfile.CredentialsB64 != "" {
147 data, err := base64.StdEncoding.DecodeString(currentProfile.CredentialsB64)
148 if err != nil {
149 return nil, fmt.Errorf("failed to decode credentials: %w", err)
150 }
151 return data, nil
152 }
153
154 // Try credentials file
155 if currentProfile.CredentialsPath != "" {
156 data, err := os.ReadFile(currentProfile.CredentialsPath)
157 if err != nil {
158 return nil, fmt.Errorf("failed to read credentials file: %w", err)
159 }
160 return data, nil
161 }
162
163 return nil, fmt.Errorf("no credentials configured for profile '%s'. Run 'playconsole-cli auth login' first", currentProfile.Name)
164}
165
166// SetDebug sets debug mode
167func SetDebug(d bool) {

Callers 5

NewClientFunction · 0.92
NewReportingClientFunction · 0.92
fetchAppsFunction · 0.92
checkCredentialsFunction · 0.92
checkServiceAccountFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected