MCPcopy Index your code
hub / github.com/coder/coder / Exchange

Method Exchange

coderd/oauthpki/oidcpki.go:124–134  ·  view source on GitHub ↗

Exchange includes the client_assertion signed JWT.

(ctx context.Context, code string, opts ...oauth2.AuthCodeOption)

Source from the content-addressed store, hash-verified

122
123// Exchange includes the client_assertion signed JWT.
124func (ja *Config) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error) {
125 signed, err := ja.jwtToken()
126 if err != nil {
127 return nil, xerrors.Errorf("failed jwt assertion: %w", err)
128 }
129 opts = append(opts,
130 oauth2.SetAuthURLParam("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),
131 oauth2.SetAuthURLParam("client_assertion", signed),
132 )
133 return ja.cfg.Exchange(ctx, code, opts...)
134}
135
136func (ja *Config) jwtToken() (string, error) {
137 now := time.Now()

Calls 3

jwtTokenMethod · 0.95
ExchangeMethod · 0.65
ErrorfMethod · 0.45