Closed opchaves closed 6 months ago
The typescript definition for the scope prop on version 2.1.2 says it can be OauthScope | OauthScope[]. When I try passing an array of scopes it the request fails with an invalid_scope error and this is due to an invalid url that is being generated.
scope
OauthScope | OauthScope[]
invalid_scope
const authLink = WebflowClient.authorizeURL({ state: webflow.state, // @ts-ignore scope: [OauthScope.SitesRead, OauthScope.SitesWrite, OauthScope.AuthorizedUserRead], redirectUri: webflow.redirectUri, clientId: webflow.clientId, }); // Error response /webflow/auth?error=invalid_scope&error_description=The%20following%20scopes%20are%20invalid%3A%20sites%3Aread%2Bsites%3Awrite%2Bauthorized_user%3Aread&state=<some-state>
To make it work I'm using @ts-ignore and interpolation to pass all scopes I need.
@ts-ignore
const authLink = WebflowClient.authorizeURL({ state: webflow.state, // @ts-ignore scope: `${OauthScope.SitesRead} ${OauthScope.SitesWrite} ${OauthScope.AuthorizedUserRead}`, redirectUri: webflow.redirectUri, clientId: webflow.clientId, });
Additionally the OauthScope type doesn't include all the scope types listed here.
OauthScope
@opchaves @tomelliot this is fixed in v2.2.1, please reopen if you still have issues!
v2.2.1
The typescript definition for the
scope
prop on version 2.1.2 says it can beOauthScope | OauthScope[]
. When I try passing an array of scopes it the request fails with aninvalid_scope
error and this is due to an invalid url that is being generated.To make it work I'm using
@ts-ignore
and interpolation to pass all scopes I need.