MCPcopy Create free account
hub / github.com/UiPath/uipathcli / GetToken

Method GetToken

auth/identity_client.go:24–43  ·  view source on GitHub ↗
(tokenRequest tokenRequest)

Source from the content-addressed store, hash-verified

22const redactedMessage = "**redacted**"
23
24func (c identityClient) GetToken(tokenRequest tokenRequest) (*tokenResponse, error) {
25 request := tokenRequestForm{
26 GrantType: tokenRequest.GrantType,
27 Scopes: tokenRequest.Scopes,
28 ClientId: tokenRequest.ClientId,
29 ClientSecret: tokenRequest.ClientSecret,
30 Code: tokenRequest.Code,
31 CodeVerifier: tokenRequest.CodeVerifier,
32 RedirectUri: tokenRequest.RedirectUri,
33 RefreshToken: tokenRequest.RefreshToken,
34 Properties: tokenRequest.Properties,
35 }
36 response, err := c.retrieveToken(tokenRequest.BaseUri, request, tokenRequest.Settings)
37 if err != nil {
38 return nil, err
39 }
40
41 expiresAt := time.Now().UTC().Add(time.Duration(response.ExpiresIn) * time.Second)
42 return newTokenResponse(response.AccessToken, expiresAt, response.RefreshToken), nil
43}
44
45func (c identityClient) retrieveToken(baseUri url.URL, form tokenRequestForm, settings network.HttpClientSettings) (*tokenResponseJson, error) {
46 uri := baseUri.JoinPath(tokenRoute)

Callers 3

retrieveTokenMethod · 0.80
renewAuthTokenMethod · 0.80
AuthMethod · 0.80

Calls 3

retrieveTokenMethod · 0.95
newTokenResponseFunction · 0.85
AddMethod · 0.80

Tested by

no test coverage detected