juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.02k stars 1.19k forks source link

fix(users): clear cookie and alter parsing for sso #5147

Closed apoorvdixit88 closed 5 days ago

apoorvdixit88 commented 5 days ago

Type of Change

Description

The PR

Additional Changes

Motivation and Context

closes #5146

How did you test it?

For bad request id for in auth select:

curl --location 'http://localhost:8080/user/auth/select' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT' \
--data '{
    "id":"wrong id"
}'

Response

{
    "error": {
        "type": "invalid_request",
        "message": "Invalid user auth method operation",
        "code": "UR_44"
    }
}

For valid id Response token type can be sso or totp, (tested for both valid ids from db to get correct token type)

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYjJkNjMxZDUtMGQzMi00Y2IxLTg2MTQtNWVlNWI2MDczYTVkIiwicHVycG9zZSI6InNzbyIsIm9yaWdpbiI6ImFjY2VwdF9pbnZpdGF0aW9uX2Zyb21fZW1haWwiLCJwYXRoIjpbImF1dGhfc2VsZWN0Il0sImV4cCI6MTcxOTY2NjMxNX0.wz8bA3_xqD1J59t3N7jhMCpC-uQDZE2edMED93f8RrY",
    "token_type": "sso"
}

Checklist