MCPcopy Create free account
hub / github.com/Waishnav/devspace / exchangeAuthorizationCode

Method exchangeAuthorizationCode

src/oauth-provider.ts:191–208  ·  view source on GitHub ↗
(
    client: OAuthClientInformationFull,
    authorizationCode: string,
    _codeVerifier?: string,
    redirectUri?: string,
    resource?: URL,
  )

Source from the content-addressed store, hash-verified

189 }
190
191 async exchangeAuthorizationCode(
192 client: OAuthClientInformationFull,
193 authorizationCode: string,
194 _codeVerifier?: string,
195 redirectUri?: string,
196 resource?: URL,
197 ): Promise<OAuthTokens> {
198 const record = this.validCodeRecord(client, authorizationCode);
199 if (redirectUri && redirectUri !== record.params.redirectUri) {
200 throw new InvalidGrantError("redirect_uri does not match the authorization request");
201 }
202 if (resource && !checkResourceAllowed({ requestedResource: resource, configuredResource: this.resourceServerUrl })) {
203 throw new InvalidGrantError("Invalid resource");
204 }
205
206 this.codes.delete(authorizationCode);
207 return this.issueTokens(client.client_id, record.params.scopes ?? this.config.scopes, record.params.resource);
208 }
209
210 async exchangeRefreshToken(
211 client: OAuthClientInformationFull,

Calls 2

validCodeRecordMethod · 0.95
issueTokensMethod · 0.95

Tested by 1