-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SLAS social login helper #172
Conversation
slasHelper.ts
interface ClientOptions { | ||
codeChallenge?: string; | ||
} | ||
const clientOptions: ClientOptions = {}; | ||
if (!privateClient) { | ||
clientOptions.codeChallenge = await generateCodeChallenge(codeVerifier); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only generating the codeChallenge
for private clients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean for public clients? Since the if statement said "if NOT privateClient"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yunakim714 I checked the SLAS doc, it seems that codeChallege is still needed for private client. Check here for registerer users flow, it requires code_challenge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SLAS team are working on changing the RAML now to make this optional - thread here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this thread come to a resolution? Or was there simply a typo in the first comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bendvc @alexvuong Ah yes, I meant only generating the codeChallenge
for public clients😅
@@ -93,6 +93,14 @@ export class {{name.upperCamelCase}}<ConfigParameters extends {{{name.upperCamel | |||
|
|||
static readonly defaultBaseUri = "{{getBaseUriFromDocument model}}"; | |||
|
|||
static readonly apiPaths = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creates a read only apiPaths
object that maps the API endpoint name to the API path
In order to implement social login in the PWA Kit and enable this feature for our customers, we need a social login helper in
commerce-sdk-isomorphic
.GUS: W-16543984
Changes
authorizeIDP
andloginIDPUser
BECAUSE:authorizeCustomer
returns an auth URL that has to be navigated to from the top level browser in order for the app to be properly redirected to the 3rd party login page and for the user to be able to input their login credentialsloginIDPUser
to exchange theusid
andcode
for an access tokenapiPaths
readonly map to the client template that maps the API names to the API pathTesting
yarn test
and verify that all tests passE2e test:
token
call is in the Network tab and you see the access token in the response