mirror of
https://github.com/quexten/goldwarden.git
synced 2024-12-25 04:14:02 +03:00
Fix passwordless login on official bitwarden instance
This commit is contained in:
parent
193fa60475
commit
ef5083cfb4
@ -144,7 +144,7 @@ func LoginWithDevice(ctx context.Context, email string, cfg *config.Config, vaul
|
||||
case <-timeoutChan:
|
||||
return LoginResponseToken{}, crypto.MasterKey{}, "", fmt.Errorf("timed out waiting for device to be authorized")
|
||||
default:
|
||||
authRequestData, err := GetAuthRequest(ctx, data.ID, cfg)
|
||||
authRequestData, err := GetAuthResponse(ctx, accessCode, data.ID, cfg)
|
||||
if err != nil {
|
||||
log.Error("Could not get auth request: %s", err.Error())
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ func makeAuthenticatedHTTPRequest(ctx context.Context, req *http.Request, recv i
|
||||
if token, ok := ctx.Value(AuthToken{}).(string); ok {
|
||||
req.Header.Set("Authorization", "Bearer "+token)
|
||||
}
|
||||
req.Header.Set("device-type", deviceType())
|
||||
|
||||
res, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
|
@ -104,3 +104,9 @@ func CreateAuthRequest(ctx context.Context, code string, deviceIdentifier string
|
||||
return authrequestData, nil
|
||||
}
|
||||
}
|
||||
|
||||
func GetAuthResponse(ctx context.Context, code string, requestUUID string, config *config.Config) (AuthRequestData, error) {
|
||||
var authRequest AuthRequestData
|
||||
err := authenticatedHTTPGet(ctx, config.ConfigFile.ApiUrl+"/auth-requests/"+requestUUID+"/response?code="+code, &authRequest)
|
||||
return authRequest, err
|
||||
}
|
Loading…
Reference in New Issue
Block a user