ForceCLI/force

Refreshing Session Token: ERROR: Post /services/oauth2/token: unsupported protocol scheme ""

Closed this issue · 3 comments

If you're using a custom endpoint for tokens, and your session expires, then refreshTokenURL has trouble refreshing the session token:

slaw@mittens:~/work/src/github.com/ForceCLI/force$ ./force fetch -t CustomObject
Refreshing Session Token
Post /services/oauth2/token: unsupported protocol scheme ""
ERROR: Post /services/oauth2/token: unsupported protocol scheme ""

This is because refreshTokenURL calls tokenURL while CustomEndpoint == '':

force/lib/force.go

Lines 303 to 311 in 063d47e

func (f *Force) refreshTokenURL() string {
var refreshURL string
endpoint := f.Credentials.ForceEndpoint
refreshURL, err := tokenURL(endpoint)
if err != nil {
ErrorAndExit(err.Error())
}
return refreshURL
}

I think the hacky solution would be setting:

CustomEndpoint = f.Credentials.InstanceUrl

I'm facing the same issue. Appreciate if this can be fixed. Thanks!

#543 should fix this.

Fixed in #543